Rendering method and device and medium

By constructing an octree and using a view frustum hierarchy, combined with view frustum culling and multi-level occlusion culling techniques, the problem of rendering performance degradation in complex 3D scenes was solved, achieving efficient spatial management and accurate visibility judgment, thus improving rendering efficiency and quality.

CN120953461APending Publication Date: 2025-11-14CISDI ENGINEERING CO LTD +1
View PDF 0 Cites 3 Cited by

Patent Information

Application Number
CN202511077189.9
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2025-08-01
Publication Date
2025-11-14

AI Technical Summary

Technical Problem

Existing technologies struggle to balance the efficiency of frustum culling and occlusion culling when rendering complex 3D scenes, leading to a decline in rendering performance. This is especially true when dealing with multi-layered frustums and complex occlusion relationships, making it difficult to achieve efficient spatial management and accurate visibility assessment.

Method used

By constructing an octree to manage the 3D scene space, the view frustum is divided into different view frustum levels. Combined with view frustum culling and multi-level occlusion culling techniques, the rendering process is optimized using Hi-z occlusion culling and pixel-level occlusion culling to accurately identify visible objects.

Benefits of technology

It significantly improves rendering performance, optimizes space management, enhances the processing efficiency of complex scenes, reduces rendering load, avoids screen flickering caused by excessive culling of near-field cone regions, and reduces invalid drawing calls for mid- to far-field objects.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120953461A_ABST
    Figure CN120953461A_ABST
Patent Text Reader

Abstract

The invention discloses a rendering method, which comprises the following steps: constructing an octree, and storing a to-be-rendered object in a to-be-rendered three-dimensional scene in a child node of the octree to obtain a space management octree; dividing the view cone into different view cone levels; traversing the space management octree, and determining a first intersection part between the space of the child node and the view cone and a view cone level to which the first intersection part belongs; distributing the first intersection part to different rendering queues according to the view cone hierarchy to which the first intersection part belongs; shielding and removing the first intersection parts in the different rendering queues to obtain current visible objects to be rendered; and rendering the current visible to-be-rendered object. According to the method, the octree is constructed to manage the three-dimensional scene space, the view cone levels are divided, the rendering queues are distributed, the view cone removing and multi-level shielding removing technologies are combined, the visible objects are accurately judged, the rendering load is effectively reduced, and the method has the advantages that the rendering performance is improved, space management is optimized, and the complex scene processing efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This invention relates to the field of 3D real-time rendering technology, specifically to a rendering method, apparatus, and medium. Background Technology

[0002] In the field of real-time 3D rendering, frustum culling and occlusion culling are core technologies for optimizing rendering performance. Frustum culling detects the spatial relationship between the object's bounding volume and the view frustum, eliminating invisible objects outside the view frustum. Occlusion culling further eliminates invisible objects within the view frustum that are occluded by other objects, thereby reducing the rendering load on the GPU. In the rendering of complex 3D scenes, multiple sub-scenes often occlude each other. Taking the steel metallurgy industry as an example, a large steel plant covering the entire steel production process needs to include multiple production sub-scenes such as raw material yards, ironmaking workshops, steelmaking workshops, continuous casting workshops, and rolling mills. In such complex scenes, how to better handle the spatial relationship of mutual occlusion between objects, accurately eliminate invisible objects occluded within the view frustum, and thus improve rendering performance is a problem of great research value. Existing technologies often struggle to balance the efficiency of frustum culling and occlusion culling when handling large-scale scene rendering, leading to a decline in rendering performance. This is especially true when dealing with multi-layered view frustums and complex occlusion relationships, where existing methods struggle to achieve efficient spatial management and accurate visibility judgment. To address the aforementioned issues, existing technologies urgently need improvement. Summary of the Invention

[0003] In view of the shortcomings of the prior art described above, the present invention provides a rendering method, apparatus and medium to solve at least one of the defects in the prior art.

[0004] The present invention provides a rendering method, the rendering method comprising:

[0005] Construct an octree and store the objects to be rendered in the 3D scene to be rendered in the child nodes of the octree to obtain a space management octree;

[0006] The visual cone is divided into different visual cone levels;

[0007] Traverse the space management octree to determine the first intersection between the space of the child node and the view frustum, and the view frustum level to which the first intersection belongs;

[0008] The first intersection portion is assigned to different rendering queues according to its respective view frustum level;

[0009] The first intersection portion of the different rendering queues is occluded and culled to obtain the currently visible object to be rendered.

[0010] Render the currently visible object to be rendered.

[0011] In one embodiment of the present invention, the first intersection portion between the space of the determined child node and the view frustum includes:

[0012] Transform the six faces of the aforementioned cone into world space;

[0013] Based on the positional information of the six faces of the view frustum in the world space, determine the spatial positional relationship between each face and the child node;

[0014] If the space of the child node is outside any face, then the space of the child node does not intersect with the view frustum;

[0015] If the space of the child node is inside at least one face, then the space of the child node intersects with the view frustum;

[0016] View frustum culling is performed on the objects to be rendered within the space of the child nodes associated with the view frustum to obtain the first intersection between the space of the child nodes and the view frustum.

[0017] In one embodiment of the present invention, dividing the visual cone into different visual cone levels includes:

[0018] Based on the depth values ​​of the near and far planes of the visual cone, the visual cone is divided into myopic cone, intermediate cone, and hyperopic cone layers using a hybrid segmentation strategy.

[0019] The hybrid segmentation strategy includes:

[0020] Where λ represents a constant.

[0021] n is the near-plane depth, f is the far-plane depth, and m1 and m2 are the number of segments.

[0022] In one embodiment of the present invention, before allocating the intersection portion to different rendering queues according to its respective view frustum level, the method further includes:

[0023] Determine the second intersection between the object to be rendered in the child node and the view frustum, and the view frustum level to which the second intersection belongs;

[0024] The second intersection portion is assigned to different rendering queues according to its respective view frustum level.

[0025] In one embodiment of the present invention, the step of occlusion culling of the first intersection portion in the different rendering queues to obtain the currently visible object to be rendered includes:

[0026] For the aforementioned myopia cone level, the rendering operation is performed directly on the first intersection portion;

[0027] For the mid-view frustum level and the far-view frustum level, Hi-z occlusion culling is used to cullate the first intersection part to obtain the culling result; the culling result is then culled by pixel-level occlusion culling to obtain the currently visible object to be rendered.

[0028] In one embodiment of the present invention, the step of using Hi-z occlusion culling to occlude the first intersection portion includes:

[0029] Calculate the bounding box size of the objects to be rendered in the first intersection region in the NDC coordinate system;

[0030] Match the corresponding Mipmap according to the bounding box size; wherein, the Mipmap matching the bounding box size is one of the levels in the multi-level Mipmap; in the multi-level Mipmap, the depth value in each level Mipmap is the maximum depth value of the four adjacent element regions in the previous level Mipmap;

[0031] The depth value of the object to be rendered is compared with the depth value of the corresponding Mipmap level. If the depth value of the object to be rendered is greater than the depth value of the corresponding Mipmap level, the object to be rendered is deleted.

[0032] In one embodiment of the present invention, the step of matching the corresponding Mipmap according to the bounding box size includes:

[0033] Using the model pre-transformation matrix, world transformation matrix, and view projection transformation matrix, the bounding box of the object to be rendered is transformed to the NDC coordinate system;

[0034] Obtain the lengths LengthX and LengthY of the standard bounding box in the X and Y axes of the NDC coordinate system, as well as the width widthMip0 and height heightMip0 of the level 0 Mipmap.

[0035] MipLevel=Cell(log2(max(LengthX,LengthY)))

[0036] LengthX=(maxX-minX)*0.5*widthMip0

[0037] LengthY=(maxY-minY)*0.5*heigthMip0.

[0038] In one embodiment of the present invention, the step of removing the occlusion result by pixel-level occlusion removal includes:

[0039] On the GPU side, the bounding boxes of objects to be rendered in the scene are pre-rendered, and depth and stencil tests are performed through pixel shaders to generate visibility determination results for each object to be rendered.

[0040] Allocate a visibility buffer of equal length to the number of objects to be rendered, and store the visibility determination results;

[0041] Based on the visibility buffer, the drawing commands corresponding to the visible objects to be rendered are filled into the command buffer in a fragment-free and compact manner.

[0042] Execute the drawing commands in the command buffer, render all visible objects to be rendered, and update the depth buffer.

[0043] The present invention provides a rendering apparatus, the rendering apparatus comprising:

[0044] A construction module is used to construct an octree and store the objects to be rendered in the 3D scene to be rendered in the child nodes of the octree to obtain a space management octree;

[0045] The partitioning module is used to divide the view frustum into different view frustum levels;

[0046] The intersection determination module is used to traverse the space management octree, determine the first intersection part between the space of the child node and the view frustum, and the view frustum level to which the first intersection part belongs;

[0047] The allocation module is used to allocate the first intersection portion to different rendering queues according to the view frustum level to which it belongs;

[0048] The culling module is used to cullate the first intersection portion in the different rendering queues to obtain the currently visible object to be rendered.

[0049] The rendering module is used to render the currently visible object to be rendered.

[0050] The present invention provides a machine-readable medium having instructions stored thereon that, when executed by one or more processors, cause the processors to perform the rendering method.

[0051] The beneficial effects of this invention are:

[0052] A rendering method according to the present invention includes: constructing an octree and storing the objects to be rendered in the 3D scene to be rendered in the child nodes of the octree to obtain a space management octree; dividing the view frustum into different view frustum levels; traversing the space management octree to determine the first intersection between the space of the child node and the view frustum, and the view frustum level to which the first intersection belongs; allocating the first intersection to different rendering queues according to the view frustum level; performing occlusion culling on the first intersection in the different rendering queues to obtain the currently visible objects to be rendered; and rendering the currently visible objects to be rendered. The present invention manages the 3D scene space by constructing an octree, dividing the view frustum level and allocating rendering queues, and combining view frustum culling and multi-level occlusion culling techniques to accurately determine visible objects, effectively reduce rendering load, and has the advantages of improving rendering performance, optimizing space management, and improving the efficiency of handling complex scenes. Attached Figure Description

[0053] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention. It is obvious that the drawings described below are merely some embodiments of the invention, and those skilled in the art can obtain other drawings based on these drawings without any inventive effort.

[0054] In the attached diagram:

[0055] Figure 1 This is a flowchart of a rendering method according to an embodiment of the present invention;

[0056] Figure 2 This is a flowchart illustrating the determination of the first intersection between the space of a child node and the view frustum according to an embodiment of the present invention;

[0057] Figure 3 This is a flowchart of Hi-z occlusion culling according to an embodiment of the present invention;

[0058] Figure 4 This is a flowchart illustrating pixel-level occlusion culling according to an embodiment of the present invention.

[0059] Figure 5 This is a schematic diagram of a real-time rendering scene during a culling efficiency test according to an embodiment of the present invention.

[0060] Figure 6 This is a schematic diagram of a rendering apparatus according to an embodiment of the present invention;

[0061] Figure 7 A schematic diagram of a computer system suitable for implementing an embodiment of the present invention is shown. Detailed Implementation

[0062] The following specific examples illustrate the implementation of the present invention. Those skilled in the art can easily understand other advantages and effects of the present invention from the content disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments. Various details in this specification can also be modified or changed based on different viewpoints and applications without departing from the spirit of the present invention. In the absence of conflict, the following embodiments and features in the embodiments can be combined with each other.

[0063] It should be noted that the illustrations provided in the following embodiments are only schematic representations of the basic concept of the present invention. The drawings only show the components related to the present invention and are not drawn according to the actual number, shape and size of the components in the actual implementation. In the actual implementation, the shape, quantity and proportion of each component can be arbitrarily changed, and the layout of the components may also be more complex.

[0064] In the following description, numerous details are explored to provide a more thorough explanation of embodiments of the invention. However, it will be apparent to those skilled in the art that embodiments of the invention may be practiced without these specific details. In other embodiments, well-known structures and devices are shown in block diagram form rather than in detail to avoid obscuring embodiments of the invention.

[0065] In existing technologies, the field of real-time 3D rendering has long relied on frustum culling and occlusion culling techniques to optimize performance. However, as scene complexity increases, traditional methods are becoming increasingly inadequate in handling dynamic objects and multi-layered occlusion relationships. Taking a steel metallurgy scene as an example, sub-scenes such as the raw material yard and rolling mill contain numerous mutually occluding devices and structures. Existing technologies struggle to efficiently handle occluded, invisible objects within the view frustum, resulting in persistently high rendering loads.

[0066] To address the aforementioned issues, researchers analyzed the spatial distribution patterns of scene objects and proposed combining spatial management with view frustum grading. They then optimized the culling process using a hierarchical data structure, thereby reducing computational overhead while maintaining culling accuracy.

[0067] Please see Figure 1 , Figure 1 This is a flowchart illustrating a rendering method according to an embodiment of the present invention. Figure 1 In the rendering process, the methods include:

[0068] Step S110: Construct an octree and store the objects to be rendered in the 3D scene to be rendered in the child nodes of the octree to obtain a space management octree;

[0069] An octree is a tree-like data structure that recursively divides a three-dimensional space into eight child nodes. Specifically, it can use axis-aligned bounding boxes to divide the scene space, enabling fast spatial retrieval of scene objects.

[0070] When constructing the octree, a relaxed octree is built iteratively based on the position information of each model in the scene to be rendered, and objects are inserted. Each node of the octree represents a cube subspace, and each node has eight child nodes. During iterative tree construction, the iteration stops when the set maximum depth is reached.

[0071] The octree type adopts a relaxed octree with a relaxation factor of 2. When inserting an object into each node of the octree, assuming the diameter of the bounding sphere is d, calculate the octree node level at which the bounding sphere should be inserted, and find the node v at that node level that contains the center of the bounding sphere. Let the side length of the octree root node be s0, and the formula for calculating the node level is:

[0072]

[0073] Traverse the child nodes of node v. If there exists a child node p that contains the center of the enclosing sphere σ within its inner boundary and the enclosing sphere σ is within its outer boundary, then store it in the child node p. If it does not exist, then store σ in node v.

[0074] Based on the steps above, it can be seen that, compared with the traditional octree, the relaxed octree requires further judgment, namely:

[0075]

[0076] Compared to traditional octrees, relaxed octrees enlarge the cube region of each node by a certain proportion, causing the enclosing cubes of nodes at the same level to overlap. This facilitates better handling of the insertion of various objects located at node boundaries, allowing them to be more rationally distributed among the nodes and making fuller use of space.

[0077] Step S120: Divide the viewing cone into different viewing cone levels;

[0078] Among them, the view frustum level division refers to dividing the view frustum into multiple regions according to the viewing distance. Specifically, a logarithmic segmentation strategy can be used to divide the view frustum into three levels: near, middle, and far, to adapt to the rendering characteristics of objects at different distances.

[0079] Step S130: Traverse the space management octree to determine the first intersection between the space of the child node and the view frustum, and the view frustum level to which the first intersection belongs;

[0080] Step S140: Assign the first intersection portion to different rendering queues according to the view frustum level to which it belongs;

[0081] The rendering queue refers to the collection of objects classified according to the view frustum level. Specifically, a first-in-first-out buffer can be used to store the objects to be processed, thereby achieving data isolation for layered processing.

[0082] Step S150: Occlusion culling is performed on the first intersection portion of the different rendering queues to obtain the currently visible object to be rendered;

[0083] Step S160: Render the currently visible object to be rendered.

[0084] Specifically, scene objects are first organized using an octree, with each child node storing objects within its spatial range. Once the view frustum is divided into multiple levels, the octree nodes are traversed to calculate their intersection with the view frustum. Objects are then assigned to the corresponding rendering queue based on the view frustum level to which the intersection belongs. Near-level queues are rendered directly, while mid-to-far-level queues undergo layered occlusion testing. Ultimately, only visible objects that pass the test are drawn. This phased processing mechanism allows for rapid rendering of nearby objects and rigorous culling of distant objects, effectively balancing rendering efficiency and accuracy.

[0085] This invention achieves differentiated management through view frustum hierarchical partitioning and accelerates object retrieval by combining octree spatial indexing, reducing unnecessary computation in dynamic scenes. It significantly reduces GPU rendering load in complex industrial scenes by reducing unnecessary rendering calls for mid-to-far-distance objects through a layered processing mechanism, while maintaining rendering quality for nearby objects.

[0086] Please see Figure 2 , Figure 2 This is a flowchart illustrating the determination of the first intersection portion between the space of a child node and the view frustum, according to an embodiment of the present invention. Figure 2 In the process, determining the first intersection between the space of the child node and the view frustum includes:

[0087] Step S210: Transform the six faces of the view frustum into world space;

[0088] The transformation of the six faces of the view frustum to world space refers to transforming the coordinates of each face of the view frustum from the observation coordinate system to the global coordinate system. This can be achieved through the inverse matrix operation of the view matrix, so that subsequent calculations can be performed in a unified coordinate system.

[0089] Step S220: Using the position information of the six faces of the view frustum in the world space, determine the spatial positional relationship between each face and the child node;

[0090] Determining the spatial relationship between a face and its child nodes involves calculating the position of the child node's bounding box vertices relative to each face of the view frustum using plane equations. Specifically, this can be achieved by substituting the vertex coordinates into the plane equations to calculate the sign value. If all vertices are outside the plane, they are determined to be non-intersecting.

[0091] Step S230: If the space of the child node is outside any face, then the space of the child node does not intersect with the view frustum;

[0092] Step S240: If the space of the child node is inside at least one face, then the space of the child node intersects with the view frustum;

[0093] Step S250: Perform frustum culling on the objects to be rendered in the space of the child nodes related to the frustum to obtain the first intersection between the space of the child nodes and the frustum.

[0094] View frustum culling refers to filtering geometry located outside the view frustum. Specifically, it can be achieved by traversing objects within child nodes and detecting the intersection of their bounding volumes with the view frustum, thereby reducing the amount of data entering the subsequent rendering process.

[0095] Specifically, during the 3D scene rendering process, the planar equation parameters of the six faces of the view frustum are first obtained, transformed to the world coordinate system using a coordinate transformation matrix, and then normalized. Next, the spatial relationship between each face and the child node cube space is determined using the following method: First, the dot product of the center point of the cube space and the plane is calculated to obtain the distance from the center to the plane; then, the projection radius of the cube space along the plane's normal direction is calculated; comparing the distance and the projection radius yields the spatial relationship between the face and the cube. If the child node space is outside any face, then the relationship between that space and the view frustum is non-intersecting; if the child node space is inside all faces, then the relationship between that space and the view frustum is containing; otherwise, they are considered intersecting.

[0096] This invention performs detection after transforming the view frustum into world space, avoiding the computational overhead of performing matrix transformations for each vertex individually. This effectively solves the problem of excessive computational load for view frustum detection in large-scale 3D scenes. In industrial scenes such as steel metallurgy, it can quickly filter out invisible objects such as equipment outside raw material yards and external structures of workshops.

[0097] In one embodiment, dividing the visual cone into different visual cone levels includes: dividing the visual cone into myopic cone level, intermediate cone level, and hyperopic cone level according to the magnitude of the near plane and far plane depth values ​​of the visual cone using a hybrid segmentation strategy; wherein, the hybrid segmentation strategy includes:

[0098] Where λ represents a constant. Represents logarithmic partitioning. Indicates uniform division. n is the near-plane depth, f is the far-plane depth, and m1 and m2 are the number of segments.

[0099] In this system, the near plane is the smaller rectangular face of the view frustum, closest to the camera; objects outside this plane are typically not rendered. The far plane is the larger rectangular face of the view frustum, farthest from the camera; objects outside this plane are also not rendered. The hybrid segmentation strategy combines logarithmic and uniform segmentation of the view frustum. Specifically, preset segmentation numbers m1 and m2 can be used to control the segmentation density of different regions. For example, logarithmic segmentation can be used near the near plane to improve accuracy, while uniform segmentation can be used near the far plane to reduce computation. λ (typically set to 0.5-0.7) is used to adjust the transition ratio between logarithmic and uniform segmentation, combining them to avoid the excessive sparseness of the far plane region caused by uniform segmentation and the excessive density of the near plane region caused by logarithmic segmentation. Setting λ to 0.5 can achieve a more balanced segmentation effect in both the near and far plane regions. The near-plane depth n and the far-plane depth f define the depth range of the visual cone. The number of segments m1 and m2 correspond to the number of segments in the myopic cone layer and the far-opic cone layer, respectively. For example, m1 can be set to 3 and m2 can be set to 2.

[0100] Specifically, the hybrid segmentation strategy divides the view frustum depth range into two sub-ranges. The first sub-range uses logarithmic segmentation to generate m1 segmentation points, and the second sub-range uses uniform segmentation to generate m2 segmentation points, ultimately dividing the view frustum into near-view frustum, intermediate-view frustum, and far-view frustum levels. For example, when m1 = 3 and m2 = 2, logarithmic segmentation generates denser segmentation points near the near plane, resulting in a finer depth range division for the near-view frustum level, while uniform segmentation generates sparser segmentation points near the far plane, resulting in a coarser division for the far-view frustum level. Thus, objects to be rendered at different view frustum levels can be assigned to corresponding rendering queues, and subsequently, differentiated occlusion culling operations are performed based on the level characteristics.

[0101] The hybrid segmentation strategy of this invention can optimize the granularity of view frustum partitioning in complex 3D scenes by dynamically adjusting the segmentation method. It maintains high-precision segmentation in the near-field region to improve the accuracy of occlusion culling, and reduces the segmentation density in the far-field region to reduce computational overhead, thereby balancing performance and accuracy.

[0102] In one embodiment, before allocating the intersection portion to different rendering queues according to its respective view frustum level, the method further includes: determining a second intersection portion between the object to be rendered in the child node and the view frustum, and the view frustum level to which the second intersection portion belongs; and allocating the second intersection portion to different rendering queues according to its respective view frustum level.

[0103] The second intersection refers to the spatial region where the object to be rendered within the child node actually intersects with the view frustum. Specifically, it can be implemented using a bounding box intersection test algorithm, which calculates the positional relationship between the bounding box of the object to be rendered and each face of the view frustum to determine whether there is an overlapping region.

[0104] Specifically, after completing the first-level intersection judgment between the child node space and the view frustum, a second-level intersection detection is performed on each object to be rendered within the child node. First, all objects to be rendered within the child node are traversed, and the second intersection portion is calculated based on the positional relationship between the bounding box and the view frustum face. If the bounding box of an object to be rendered is completely outside the view frustum, the object is discarded; if it is partially or completely within the view frustum, its view frustum level is determined based on the depth value of its bounding box center point. For example, in a steel mill steelmaking workshop scene, a child node may contain multiple converter equipment. The second intersection judgment can filter out the converter components actually located within the view frustum, and then allocate them to the corresponding rendering queue based on their depth.

[0105] This invention employs a dual intersection judgment mechanism to perform precise object-level detection on top of child node-level screening, effectively reducing false judgments and enabling more refined object visibility management in complex 3D scenes.

[0106] In one embodiment, the step of performing occlusion culling on the first intersection portion in the different rendering queues to obtain the currently visible object to be rendered includes: for the myopic cone level, directly performing a rendering operation on the first intersection portion; for the intermediate cone level and the hyperopic cone level, using Hi-z occlusion culling to perform occlusion culling on the first intersection portion to obtain a culling result; and removing the culling result through pixel-level occlusion culling to obtain the currently visible object to be rendered.

[0107] Hi-z occlusion culling refers to a culling method based on fast depth comparison using multi-level depth maps. Specifically, it employs a multi-level mipmap structure to store depth information, generating depth maps of different resolutions through progressive downsampling. The projection size of the bounding box in the NDC coordinate system is used to match the corresponding level of the mipmap, and occlusion determination is achieved by comparing the object's depth value with the maximum depth value in the mipmap. Pixel-level occlusion culling refers to GPU-based depth pre-rendering technology. Specifically, it involves pre-rendering the bounding box of the object to be rendered on the GPU, performing depth and stencil tests using pixel shaders to generate visibility determination results, and storing the visibility information in a buffer to optimize the submission of drawing commands.

[0108] Specifically, in complex 3D scenes, such as a steel plant containing multiple production sub-scenes, objects at the near-view frustum level typically occupy a large area of ​​the screen and have complex occlusion relationships. Direct rendering can avoid visual artifacts caused by erroneous culling. Meanwhile, objects at the mid-view frustum and far-view frustum levels are numerous and smaller in size. Hi-z occlusion culling can quickly filter out completely occluded objects, and then pixel-level culling further eliminates partially occluded objects. For example, in a steelmaking workshop scene, near-view frustum objects such as high-temperature furnaces are rendered directly, while distant conveyor belts or robotic arms undergo a two-stage culling process, ultimately submitting only the visible portions to the GPU for rendering.

[0109] This invention implements a differentiated culling strategy through view frustum hierarchical division, which significantly reduces computational load while ensuring visual quality. It can effectively balance rendering quality and performance in large-scale industrial simulation scenarios, avoid screen flickering caused by excessive culling in near-view frustum regions, and reduce invalid drawing calls for mid- to far-distance objects, thereby improving overall rendering efficiency.

[0110] Please see Figure 3 , Figure 3 This is a flowchart illustrating Hi-z occlusion culling according to an embodiment of the present invention. Figure 3 In the above, the occlusion culling of the first intersection portion using Hi-z occlusion culling includes:

[0111] Step S310: Calculate the bounding box size of the object to be rendered in the first intersection part in the NDC coordinate system;

[0112] The bounding box size in the NDC coordinate system refers to the projection range of the object to be rendered in the normalized device coordinate system. Specifically, it can be calculated by transforming the bounding box vertex coordinates to NDC space using the model transformation matrix and the view projection matrix, and is used to determine the matching level of the subsequent Mipmap.

[0113] Step S320: Match the corresponding Mipmap according to the bounding box size; wherein, the Mipmap that matches the bounding box size is one of the levels in the multi-level Mipmap; in the multi-level Mipmap, the depth value in each level Mipmap is the maximum depth value of the four adjacent element regions in the previous level Mipmap;

[0114] The steps for generating a multi-level Mipmap include:

[0115] Step 1, assume the initial depth map is level 0 of the Mipmap;

[0116] Step 2: For each level of Mipmap, divide the depth value of the previous level into several 2×2 regions;

[0117] Step 3: For each 2×2 region, calculate the maximum value among its four depth values ​​and use this value as the depth value of the corresponding position in the current Mipmap level;

[0118] Step 4: Repeat the above steps until the lowest resolution Mipmap level is generated.

[0119] Step S330: Compare the depth value of the object to be rendered with the depth value of the corresponding Mipmap level. If the depth value of the object to be rendered is greater than the depth value of the corresponding Mipmap level, then delete the object to be rendered.

[0120] Specifically, during occlusion culling, the bounding box of the object to be rendered is first transformed to the NDC coordinate system. The matching mipmap level is determined by calculating its coverage area in the X / Y axes. For example, when the bounding box covers a large area of ​​the screen, a low-resolution mipmap level is used for fast, coarse-grained culling; when the coverage area is small, a high-resolution level is used for precise judgment. Multi-level mipmaps are generated through progressive downsampling, with each level storing the maximum depth value of the corresponding area, forming a pyramid structure. During the depth comparison phase, if the minimum depth value of the object to be rendered is greater than the stored value at the corresponding mipmap position, the object is determined to be completely occluded. This hierarchical, multi-resolution depth testing strategy effectively reduces unnecessary pixel-level testing.

[0121] This invention dynamically selects the Mipmap level by the bounding box coverage area, and combines it with a step-by-step maximum depth value generation mechanism, which can significantly reduce the computational load of depth testing while ensuring the accuracy of occlusion judgment.

[0122] In one embodiment, matching the corresponding Mipmap based on the bounding box size includes:

[0123] Using the model pre-transformation matrix, world transformation matrix, and view projection transformation matrix, the bounding box of the object to be rendered is transformed to the NDC coordinate system;

[0124] Obtain the lengths LengthX and LengthY of the standard bounding box in the X and Y axes of the NDC coordinate system, as well as the width widthMip0 and height heightMip0 of the level 0 Mipmap.

[0125] MipLevel=Cell(log2(max(LengthX,LengthY)))

[0126] LengthX=(maxX-minX)*0.5*widthMip0

[0127] LengthY=(maxY-minY)*0.5*heigthMip0.

[0128] The model pre-transformation matrix is ​​a transformation matrix that converts vertex coordinates in the model's local coordinate system to the world coordinate system. It can be implemented using a combination of translation, rotation, and scaling matrices, and is used to unify the spatial reference of different objects. The world transformation matrix is ​​a matrix that transforms coordinates in the world coordinate system to the camera's viewing space. It can be implemented using a transformation matrix based on the camera's position and orientation, and is used to establish the relative positional relationship between objects and the viewpoint. The view projection transformation matrix is ​​a matrix that converts viewing space coordinates to normalized device coordinates (NDC). It can be implemented using perspective projection or orthographic projection matrices, and is used to eliminate the influence of regions outside the view frustum. The X-axis and Y-axis lengths (LengthX and LengthY) of the bounding box in the NDC coordinate system refer to the pixel range covered by the bounding box after projection onto screen space. This can be obtained by calculating the difference between the maximum and minimum values ​​after transforming the bounding box vertex coordinates, and is used to quantify the spatial proportion of objects on the screen. The width (widthMip0) and height (heightMip0) of the level 0 Mipmap refer to the resolution parameters of the original depth map, which can be obtained by reading the initialization information of the depth buffer, and is used to establish a reference for multi-level Mipmaps.

[0129] Specifically, during occlusion culling, the bounding box of the object to be rendered is first transformed to the NDC coordinate system sequentially using the model pre-transformation matrix, world transformation matrix, and view projection transformation matrix to obtain standardized bounding box coordinates. Then, the maximum and minimum values ​​of the bounding box in the X and Y axes are extracted, and their differences are calculated as LengthX and LengthY. Simultaneously, the original resolution parameters widthMip0 and heightMip0 of the level 0 mipmap are obtained. A formula is used to establish a relationship between the screen space coverage of the bounding box and the mipmap level, dynamically selecting a mipmap level that matches the bounding box size. For example, when the bounding box covers a large screen area, a higher-level mipmap is selected to reduce computational precision, while when the bounding box covers a small area, a lower-level mipmap is selected to improve the accuracy of depth comparison. This process achieves adaptive matching of the mipmap level through mathematical mapping relationships, avoiding precision loss or computational redundancy caused by fixed-level selection.

[0130] This invention achieves dynamic adaptation of layer selection by quantizing the spatial coverage of the bounding box in the NDC coordinate system and the Mipmap resolution. This ensures the reliability of depth testing and reduces unnecessary computational overhead, effectively improving the accuracy of depth comparison during occlusion culling and avoiding erroneous or missed culling due to improper Mipmap layer selection.

[0131] Please see Figure 4 , Figure 4 This is a flowchart illustrating pixel-level occlusion culling according to an embodiment of the present invention. Figure 4 In this context, the step of removing the occlusion result through pixel-level occlusion removal includes:

[0132] Step S410: On the GPU side, pre-render the bounding boxes of the objects to be rendered in the scene, and perform depth testing and stencil testing through the pixel shader to generate the visibility determination result of each object to be rendered.

[0133] Among them, pixel-level occlusion culling refers to a method for determining the visibility of bounding boxes based on pixel-level depth and stencil tests. Specifically, it can be achieved by pre-rendering bounding boxes on the GPU and performing tests using pixel shaders. Its purpose is to accurately determine whether each object to be rendered is occluded.

[0134] Step S420: Allocate a visibility buffer of the same length as the number of objects to be rendered, and store the visibility determination results;

[0135] The visibility buffer refers to the storage area that stores the visibility determination results. Specifically, it can be implemented using a one-dimensional array of the same length as the number of objects to be rendered. Its function is to efficiently record the visibility state of each object.

[0136] Step S430: Based on the visibility buffer, fill the command buffer with the drawing commands corresponding to the visible objects to be rendered in a fragment-free and compact arrangement.

[0137] Among them, the fragment-free compact arrangement method refers to the method of arranging effective drawing commands continuously. Specifically, it can be achieved by filtering commands for invisible objects and refilling the buffer, which reduces data redundancy during command transmission.

[0138] Step S440: Execute the drawing commands in the command buffer to render all visible objects to be rendered and update the depth buffer.

[0139] Specifically, during the GPU's pre-rendering of bounding boxes, the pixel shader performs depth and stencil tests on the overlay pixels of each bounding box to determine whether the bounding box is occluded by existing depth information in the scene. The visibility determination results are written to a visibility buffer, where visible objects are marked with a first value (e.g., 1), and invisible objects are marked with a second value (e.g., 0). Based on the visibility buffer, drawing commands are filtered and rearranged into a compact format, retaining only commands for visible objects. After the command buffer is updated, the GPU directly executes the drawing instructions within, rendering visible objects and updating the depth buffer to provide the latest depth data for subsequent culling.

[0140] This invention integrates culling computation with the rendering pipeline through pixel-level testing and visibility buffer management on the GPU side, reducing the number of data transfers between the CPU and GPU. At the same time, it reduces drawing call overhead by using compact command arrangement, enabling efficient pixel-level occlusion culling in large-scale complex scenes, accurately eliminating the rendering load of occluded objects, and improving overall rendering performance by reducing GPU instruction processing overhead through compact command arrangement.

[0141] like Figure 5 As shown, in the appendix Figure 5 The rendered scene shown contains 9261 teapot models, each with 65536 triangular faces, meaning the total number of triangular faces in the scene exceeds 600 million. The models are evenly distributed at close, medium, and far distances from the camera's viewpoint, rendered using blue, green, and red respectively.

[0142] In this scenario, the culling efficiency of several culling algorithms, including frustum culling, Hi-z occlusion culling, and pixel-level occlusion culling, was tested. The test results are shown in the table below.

[0143] Table 1 Summary of Test Results

[0144]

[0145] Without enabling any culling features, the actual number of rendered models was 9261, with a rendering frame rate of only 30.9 fps. After enabling frustum culling, Hi-z occlusion culling, and pixel-level occlusion culling, the actual number of rendered models decreased to 895, and the rendering frame rate increased to 185.8 fps. The frame rate improvement after using the scene culling module was as high as 501.3%, a 6.013-fold increase. Tests demonstrate that this invention can significantly reduce the number of rendered models and substantially improve the rendering frame rate.

[0146] Please see Figure 6 , Figure 6 This is a schematic diagram of a rendering apparatus according to an embodiment of the present invention. Figure 6 In this context, the rendering device includes:

[0147] The construction module 610 is used to construct an octree and store the objects to be rendered in the 3D scene to be rendered in the child nodes of the octree to obtain a space management octree;

[0148] The partitioning module 620 is used to divide the view frustum into different view frustum levels;

[0149] The intersection determination module 630 is used to traverse the space management octree, determine the first intersection part between the space of the child node and the view frustum, and the view frustum level to which the first intersection part belongs;

[0150] The allocation module 640 is used to allocate the first intersection portion to different rendering queues according to the view frustum level to which it belongs;

[0151] The culling module 650 is used to cullate the first intersection part in the different rendering queues to obtain the currently visible object to be rendered.

[0152] The rendering module 660 is used to render the currently visible object to be rendered.

[0153] It should be noted that the rendering apparatus and rendering method provided in the above embodiments belong to the same concept. The specific ways in which each module and unit performs operations have been described in detail in the method embodiments and will not be repeated here. In practical applications, the rendering apparatus provided in the above embodiments can be assigned to different functional modules as needed, that is, the internal structure of the apparatus can be divided into different functional modules to complete all or part of the functions described above. This is not a limitation here.

[0154] Embodiments of the present invention also provide an electronic device, including: one or more processors; and a memory for storing one or more programs, wherein when the one or more programs are executed by one or more processors, the memory implements the rendering method described in the above embodiments.

[0155] Embodiments of the present invention also provide one or more machine-readable media having instructions stored thereon that, when executed by one or more processors, cause the processors to perform the rendering methods described in the above embodiments.

[0156] Figure 7 A schematic diagram of a computer system suitable for implementing an embodiment of the present invention is shown. It should be noted that... Figure 7 The computer system with the memory shown is merely an example and should not impose any limitation on the functionality and scope of use of the embodiments of the present invention.

[0157] like Figure 7 As shown, the computer system 700 includes a Central Processing Unit (CPU) 701, which can perform various appropriate actions and processes, such as executing the methods described in the above embodiments, based on a program stored in Read-Only Memory (ROM) 702 or a program loaded from storage into Random Access Memory (RAM) 703. The RAM also stores various programs and data required for system operation. The CPU 701, ROM 702, and RAM 703 are interconnected via a bus 704. An Input / Output (I / O) interface 705 is also connected to the bus 704.

[0158] The following components are connected to the I / O interface 705: an input section 706 including a keyboard, mouse, etc.; an output section 707 including a cathode ray tube (CRT), liquid crystal display (LCD), etc., and speakers, etc.; a storage section 708 including a hard disk, etc.; and a communication section 709 including a network interface card such as a LAN (Local Area Network) card, modem, etc. The communication section 709 performs communication processing via a network such as the Internet. A drive 710 is also connected to the I / O interface 705 as needed. A removable medium 711, such as a disk, optical disk, magneto-optical disk, semiconductor memory, etc., is installed on the drive 710 as needed so that computer programs read from it can be installed into the storage section 708 as needed.

[0159] In particular, according to embodiments of the present invention, the processes described above with reference to the flowcharts can be implemented as computer software programs. For example, embodiments of the present invention include a computer program product comprising a computer program carried on a computer-readable medium, the computer program including a computer program for performing the rendering methods of the aforementioned embodiments. In such embodiments, the computer program can be downloaded and installed from a network via a communication component, and / or installed from a removable medium 711. When the computer program is executed by the central processing unit (CPU) 701, it performs various functions defined in the system of the present invention.

[0160] It should be noted that the computer-readable medium shown in the embodiments of the present invention can be a computer-readable signal medium or a computer-readable storage medium, or any combination thereof. A computer-readable storage medium can be, for example, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination thereof. More specific examples of a computer-readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer disk, a hard disk, random access memory (RAM) 703, read-only memory (ROM) 702, erasable programmable read-only memory (EPROM), flash memory, optical fiber, portable compact disc read-only memory (CD-ROM), optical storage device, magnetic storage device, or any suitable combination thereof. In the present invention, a computer-readable signal medium may include a data signal propagated in baseband or as part of a carrier wave, carrying a computer-readable computer program. Such propagated data signals may take various forms, including but not limited to electromagnetic signals, optical signals, or any suitable combination thereof. Computer-readable signal media can also be any computer-readable medium other than computer-readable storage media, which can send, propagate, or transmit a program for use by or in connection with an instruction execution system, apparatus, or device. The computer program contained on the computer-readable medium can be transmitted using any suitable medium, including but not limited to wireless, wired, etc., or any suitable combination thereof.

[0161] The flowcharts and block diagrams in the accompanying drawings illustrate the architecture, functionality, and operation of possible implementations of systems, methods, and computer program products according to various embodiments of the present invention. Each block in a flowchart or block diagram may represent a module, program segment, or portion of code, which contains one or more executable instructions for implementing a specified logical function. It should also be noted that in some alternative implementations, the functions indicated in the blocks may occur in a different order than those indicated in the drawings. For example, two consecutively indicated blocks may actually be executed substantially in parallel, or they may sometimes be executed in reverse order, depending on the functions involved. It should also be noted that each block or combination of blocks in a block diagram or flowchart may be implemented using a dedicated hardware-based system that performs the specified function or operation, or using a combination of dedicated hardware and computer instructions.

[0162] The units described in the embodiments of the present invention can be implemented in software or hardware, and the described units can also be located in a processor. The names of these units do not necessarily limit the specific unit itself.

[0163] Another aspect of the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a computer's processor, causes the computer to perform the rendering method as described above. This computer-readable storage medium may be included in the memory described in the above embodiments, or it may exist independently and not incorporated into that memory.

[0164] Another aspect of the present invention provides a computer program product or computer program including computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the rendering methods provided in the various embodiments described above.

[0165] The above embodiments are merely illustrative of the principles and effects of the present invention and are not intended to limit the invention. Any person skilled in the art can modify or alter the above embodiments without departing from the spirit and scope of the present invention. Therefore, all equivalent modifications or alterations made by those skilled in the art without departing from the spirit and technical concept disclosed in the present invention should still be covered by the claims of the present invention.

Claims

1. A rendering method, characterized in that, The rendering method includes: Construct an octree and store the objects to be rendered in the 3D scene to be rendered in the child nodes of the octree to obtain a space management octree; The visual cone is divided into different visual cone levels; Traverse the space management octree to determine the first intersection between the space of the child node and the view frustum, and the view frustum level to which the first intersection belongs; The first intersection portion is assigned to different rendering queues according to its respective view frustum level; The first intersection portion of the different rendering queues is occluded and culled to obtain the currently visible object to be rendered. Render the currently visible object to be rendered.

2. The rendering method according to claim 1, characterized in that, The first intersection between the space of the determined child node and the view frustum includes: Transform the six faces of the aforementioned cone into world space; Based on the positional information of the six faces of the view frustum in the world space, determine the spatial positional relationship between each face and the child node; If the space of the child node is outside any face, then the space of the child node does not intersect with the view frustum; If the space of the child node is inside at least one face, then the space of the child node intersects with the view frustum; View frustum culling is performed on the objects to be rendered within the space of the child nodes associated with the view frustum to obtain the first intersection between the space of the child nodes and the view frustum.

3. The rendering method according to claim 1, characterized in that, The process of dividing the visual cone into different visual cone levels includes: Based on the depth values ​​of the near and far planes of the visual cone, the visual cone is divided into myopic cone, intermediate cone, and hyperopic cone layers using a hybrid segmentation strategy. The hybrid segmentation strategy includes: Where λ represents a constant. n is the near-plane depth, f is the far-plane depth, and m1 and m2 are the number of segments.

4. The rendering method according to claim 1, characterized in that, Before allocating the intersection portion to different rendering queues according to its respective view frustum level, the method further includes: Determine the second intersection between the object to be rendered in the child node and the view frustum, and the view frustum level to which the second intersection belongs; The second intersection portion is assigned to different rendering queues according to its respective view frustum level.

5. The rendering method according to claim 3, characterized in that, The step of occlusion culling of the first intersection portion in the different rendering queues to obtain the currently visible object to be rendered includes: For the aforementioned myopia cone level, the rendering operation is performed directly on the first intersection portion; For the mid-view frustum level and the far-view frustum level, Hi-z occlusion culling is used to cullate the first intersection part to obtain the culling result; the culling result is then culled by pixel-level occlusion culling to obtain the currently visible object to be rendered.

6. The rendering method according to claim 5, characterized in that, The step of using Hi-z occlusion culling to occlude and cull the first intersection portion includes: Calculate the bounding box size of the objects to be rendered in the first intersection region in the NDC coordinate system; Match the corresponding Mipmap according to the bounding box size; wherein, the Mipmap matching the bounding box size is one of the levels in the multi-level Mipmap; in the multi-level Mipmap, the depth value in each level Mipmap is the maximum depth value of the four adjacent element regions in the previous level Mipmap; The depth value of the object to be rendered is compared with the depth value of the corresponding Mipmap level. If the depth value of the object to be rendered is greater than the depth value of the corresponding Mipmap level, the object to be rendered is deleted.

7. The rendering method according to claim 6, characterized in that, The step of matching the corresponding Mipmap based on the bounding box size includes: Using the model pre-transformation matrix, world transformation matrix, and view projection transformation matrix, the bounding box of the object to be rendered is transformed to the NDC coordinate system; Obtain the lengths LengthX and LengthY of the standard bounding box in the X and Y axes of the NDC coordinate system, as well as the width widthMip0 and height heightMip0 of the level 0 Mipmap. MipLevel=Cell(log2(max(LengthX,LengthY))) LengthX=(maxX-minX)*0.5*widthMip0 LengthY=(maxY-minY)*0.5*heigthMip0.

8. The rendering method according to claim 5, characterized in that, The step of removing the occlusion result by pixel-level occlusion removal includes: On the GPU side, the bounding boxes of objects to be rendered in the scene are pre-rendered, and depth and stencil tests are performed through pixel shaders to generate visibility determination results for each object to be rendered. Allocate a visibility buffer of equal length to the number of objects to be rendered, and store the visibility determination results; Based on the visibility buffer, the drawing commands corresponding to the visible objects to be rendered are filled into the command buffer in a fragment-free and compact manner. Execute the drawing commands in the command buffer, render all visible objects to be rendered, and update the depth buffer.

9. A rendering apparatus, characterized in that, The rendering device includes: A construction module is used to construct an octree and store the objects to be rendered in the 3D scene to be rendered in the child nodes of the octree to obtain a space management octree; The partitioning module is used to divide the view frustum into different view frustum levels; The intersection determination module is used to traverse the space management octree, determine the first intersection part between the space of the child node and the view frustum, and the view frustum level to which the first intersection part belongs; The allocation module is used to allocate the first intersection portion to different rendering queues according to the view frustum level to which it belongs; The culling module is used to cullate the first intersection portion in the different rendering queues to obtain the currently visible object to be rendered. The rendering module is used to render the currently visible object to be rendered.

10. A machine-readable medium, characterized in that, It stores instructions that, when executed by one or more processors, cause the processors to perform the rendering method as described in any one of claims 1-8.

Citation Information

Cited By

  • Method for optimizing loading and rendering of large BIM (Building Information Modeling) model

    CN121258769A

  • A method for optimizing loading and rendering of a large volume BIM model

    CN121258769B

  • Real-time sampling method and system for mass data visualization

    CN122176254A