A method for rendering and optimizing LOD terrain based on quadtree structure
By using a LOD terrain rendering algorithm based on a quadtree structure and a crack repair method, the problems of large data volume and cracks in large-scale terrain rendering are solved, achieving efficient rendering and seamless connection, and improving rendering efficiency and quality.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIJING UNIV OF TECH
- Filing Date
- 2023-07-12
- Publication Date
- 2026-08-04
AI Technical Summary
Large-scale terrain rendering suffers from massive data storage and scheduling issues, resulting in slow rendering speed and high memory consumption. Meanwhile, quadtree LOD terrain rendering has crack problems, affecting rendering quality.
It employs LOD technology based on a quadtree structure, combines dynamic LOD algorithm and dual queue algorithm to optimize terrain rendering, optimizes node access through Huffman coding, and uses edge deletion technology to repair cracks, achieving fast rendering and seamless connection.
While ensuring rendering quality, it significantly improves rendering efficiency, reduces memory usage, and resolves the crack problem caused by differences in the node hierarchy of the quadtree, thereby enhancing the rendering effect.
Smart Images

Figure CN117315118B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of 3D graphics engine terrain rendering optimization, specifically to a method for LOD terrain rendering and optimization based on a quadtree structure. Background Technology
[0002] Terrain rendering falls under the category of large-scale model rendering in graphics engines. However, large-scale model rendering also brings many challenges, such as the storage and retrieval of massive terrain data, and how to maintain the realism of the surface image under such ultra-large-scale terrain conditions. These challenges include increasing the effective amount of data rendered during the rendering process and reducing the amount of data in memory. To address these issues, LOD (Level of Detail) technology is used to render large-scale terrain, which can accelerate the rendering speed of terrain and effectively reduce the amount of data in memory while ensuring rendering quality.
[0003] This method employs Level of Detail (LOD) technology based on a quadtree structure to transform ordinary terrain into a quadtree structure with different levels of detail, dynamically adjusting the terrain based on the viewpoint's distance. Specifically, in large-scale terrain rendering, when a portion of the terrain covers a small area of the screen, a coarser terrain model can be used to describe that portion, providing a geometric hierarchy model for visibility detection algorithms. This allows for rapid rendering of the entire scene, including terrain and other models. In other words, for parts of the terrain farther from the screen, a less detailed terrain model can be used instead. This significantly reduces the amount of data rendered without compromising the final rendering quality, allowing the computer to focus its performance on lighting enhancements or other tasks. This enables the computer to render more scenes or objects within the terrain while maintaining the original terrain rendering quality.
[0004] The innovation of this invention lies primarily in combining quadtree structures with Level of Detail (LOD) technology to propose a quadtree-based LOD terrain rendering algorithm. This algorithm significantly accelerates terrain rendering speed, effectively reduces the amount of data in memory, and maintains image realism while preserving rendering quality. Furthermore, addressing the crack problem caused by varying levels of adjacent nodes in the quadtree LOD terrain, a quadtree crack repair algorithm is proposed, resolving the black border issue resulting from seamless terrain transitions caused by cracks generated during rendering. Summary of the Invention
[0005] The purpose of this invention is to address the shortcomings of the aforementioned problems in large-scale terrain rendering technology by proposing a quadtree-based LOD terrain rendering and optimization method. This method improves the rendering efficiency of the entire scene while ensuring the quality of terrain rendering. Furthermore, a quadtree crack repair method is used to repair cracks generated in quadtree-based LOD terrain, achieving seamless terrain transitions and optimizing visual effects.
[0006] This invention provides a method for LOD terrain rendering and optimization based on a quadtree structure, specifically including the following steps:
[0007] Step 1: Build a rendering framework and use the OpenGL open graphics library for low-level rendering.
[0008] Step 2: Generate a grayscale image and use it to obtain the actual terrain data, then read it into memory;
[0009] Step 3: Build a camera roaming system to enable users to freely move and browse scene content by controlling the direction of the camera's position;
[0010] Step 4: Establish and initialize the quadtree structure. Given the original data of the root node and the number of levels in the quadtree, generate data for all nodes and assign various data required for rendering to each node of the quadtree.
[0011] Step 5: Combining quadtree structure and dynamic LOD terrain, a quadtree-based LOD terrain rendering algorithm is proposed, and a dynamic LOD algorithm is used to draw the terrain, so that each terrain block has a different level of detail and the terrain structure can be dynamically adjusted according to the distance of the viewpoint.
[0012] Step 6: Use a double queue approach instead of recursive operations. Traverse the entire quadtree in each frame to determine the level to which each node needs to be partitioned, thus achieving dynamic partitioning of node levels.
[0013] Step 7: Add Hough coding attributes to each node, design an algorithm to quickly traverse the quadtree and access adjacent nodes, and then use edge deletion technology to delete the edge points that border the higher-level node between two adjacent nodes to solve the gap problem.
[0014] The key feature of this invention is the proposal of a quadtree-based LOD terrain rendering optimization algorithm. It employs a dual-queue approach instead of a recursive algorithm, improving the rendering quality and efficiency of large-scale dynamic terrain while effectively reducing computer memory consumption. Furthermore, it proposes a quadtree crack repair method to solve the black border problem caused by the inability to seamlessly connect terrain tiles due to different levels of adjacent quadtree nodes. This provides an effective technical foundation for 3D graphics engines in optimizing large-scale terrain and scene rendering. Attached Figure Description
[0015] Figure 1 This is the overall flowchart of the present invention.
[0016] Figure 2 This is a schematic diagram showing the position and orientation of a camera in space within a camera roaming system.
[0017] Figure 3 This is a schematic diagram of a quadtree structure.
[0018] Figure 4 This is a schematic diagram of the root node of a quadtree.
[0019] Figure 5 This is a schematic diagram of the child nodes of a quadtree.
[0020] Figure 6 This is a schematic diagram of Hough coding for a quadtree node.
[0021] Figure 7 This is a schematic diagram of adjacent nodes at different levels. Detailed Implementation
[0022] The present invention will now be described in detail through specific embodiments.
[0023] This embodiment presents a Level of Detail (LOD) terrain rendering and optimization method based on a quadtree structure. The method consists of a quadtree-based LOD terrain rendering algorithm, a double-queue algorithm replacing recursion, a quadtree fast traversal algorithm, and a quadtree crack repair method.
[0024] A specific implementation example includes the following steps:
[0025] Step 1: Build the rendering framework. Use the OpenGL open graphics library for low-level rendering and the GLFW library for building the specific OpenGL framework.
[0026] The code calls the `GlfwInit()` initialization function from the GLFW library to release related resources; the `GlfwWindowHint()` window setup function to set whether the window size can be changed, and whether it has a title bar and border; the `GlfwCreateWindow()` window creation function to create the window and set its parameters, including the window's length and width, title, etc. After executing the initialization function, this function is called to create a basic window for displaying rendered content; the `GlfwSetKeyCallback()` key callback function to bind the relevant keyboard keys; the `GlfwSetCursePosCallback()` mouse callback function to bind the mouse and obtain its coordinates; and the `GlfwSetMouseButtonCallback()` mouse button callback function to bind the left and right mouse buttons and the mouse wheel.
[0027] Step 2: Obtaining terrain data. Using Photoshop, create a new image. The width and height represent the length and width of the terrain, respectively. Here, both can be set to 255. Select grayscale as the color mode, and then generate a random grayscale image. Then, convert the original grayscale image data into usable terrain height data.
[0028] A grayscale image is generated and read into memory. The grayscale value of each pixel in the grayscale image is obtained, which represents the height value of the corresponding terrain node. All grayscale values are stored in an array whose length is the product of the length and width of the grayscale image.
[0029] Then, the basic terrain data is defined—terrain vertices. Each terrain vertex corresponds to a pixel in the grayscale image. The X and Z coordinates of each terrain vertex in world space determine the length and width of the entire terrain map, so these are set to constant values. The Z value of a terrain vertex determines its height, so the grayscale value of the corresponding pixel in the grayscale image is mapped to the Z value of the terrain vertex. When converting the grayscale value to a height value, a magnification factor is multiplied, typically set to 50-100. Finally, each element in the array stores the XYZ value of each terrain vertex in the world space coordinate system.
[0030] Step 3: Use the camera-related operation function gluLookAt() integrated in the OpenGL library. This function takes three parameters: camera position, viewing direction, and orientation. Given these parameter values, it generates the corresponding view matrix. Multiply the viewing direction parameter by a velocity coefficient and add it to the previous camera position vector to obtain the camera's position parameter. Finally, bind this parameter to the mouse and keyboard arrow keys to create a camera roaming system where the camera's orientation can be controlled by the mouse and the camera can be moved using the keyboard.
[0031] The camera's position, viewing direction, and orientation can all be represented by a three-dimensional vector. By observing the coordinate axes above: assuming the camera's initial position is at the origin of the coordinate axes, and the camera's viewing direction forms an angle alpha with the Z-axis and an angle theta with the X-axis, the following formula can be obtained through observation:
[0032] X = cos(theta) * sin(alpha)
[0033] Y = sin(theta)
[0034] Z = cos(theta) * cos(alpha)
[0035] CameraDriection = cos(theta)
[0036] Where X, Y, and Z represent the offset of the camera position in the viewing direction, CameraDriection represents the camera's orientation, and the vector (X,Y,Z) represents the camera's viewing direction parameters.
[0037] Step 4: Create and initialize the quadtree structure, where the quadtree structure is as follows: Figure 3 As shown; given the original data of the root node and the number of levels in the quadtree, generate data for all nodes and assign various data required for rendering to each node of the quadtree.
[0038] In this quadtree, the root node is a closed triangular sector consisting of eight triangles. The four vertices of the quadtree node are called CornerPoint0-3, the center points of the four edges are called EdgePoint0-3, and the center point is called CenterPoint. Figure 4 As shown.
[0039] The rendering data of any node in a quadtree can be calculated from its parent node. The rendering data of the root node can be directly obtained from the grayscale image. Given the data of the root node of the quadtree, the child nodes are initialized level by level, and the data of all nodes in the quadtree is calculated.
[0040] The calculation method is as follows:
[0041] (1) The root node of the quadtree always corresponds to the edge of the entire terrain. Taking a terrain tile with a resolution of 256*256 as an example, the value of CornerPoint0 of the root node is the first vertex of the top left corner of the terrain, which is always 0; the value of CornerPoint1 of the root node is the vertex of the bottom left corner of the terrain, which is 256*(256-1)=65280; the value of CornerPoint2 of the root node is the vertex of the bottom right corner of the terrain, which is 256*256-1=65535; the value of CornerPoint3 of the root node is the vertex of the top right corner of the terrain, which is the last number of the vertices in the first row: 255. Then, the center point value of the root node and the center point value of the four edges are calculated based on the four vertex values of the root node to complete the initialization of the quadtree root node. The calculation method of the center point value of the root node and the center point value of the four edges is as follows:
[0042] The center point value of the root node:
[0043] CenterPoint=(CornerPoint0+CornerPoint2) / 2
[0044] The center values of the four edges of the root node:
[0045] EdgePoint0=(CornerPoint0+CornerPoint1) / 2
[0046] EdgePoint1=(CornerPoint1+CornerPoint2) / 2
[0047] EdgePoint2=(CornerPoint2+CornerPoint3) / 2
[0048] EdgePoint3=(CornerPoint3+CornerPoint0) / 2
[0049] (2) After the root node is initialized, the child nodes are initialized, and the vertex values, center point values, and center point values of the four sides of the child nodes are calculated. For example Figure 5 As shown, the closed triangle sector in the upper left corner is a child node of the root node. The data of this child node can be calculated from its parent node, and the calculation method is as follows:
[0050] The values of the four vertices of the child node are: Corner_A = CornerPoint0, Corner_B = EdgePoint0, Corner_C = CenterPoint, Corner_D = EdgePoint3. Then, the center point value of the child node and the center point values of the four edges are calculated similarly.
[0051] Center point value of child node:
[0052] Center=(Corner_A+Corner_C) / 2
[0053] The center point values of the four edges of the child node:
[0054] Edge_A=(Corner_A+Corner_B) / 2
[0055] Edge_B=(Corner_B+Corner_C) / 2
[0056] Edge_C=(Corner_C+Corner_D) / 2
[0057] Edge_D=(Corner_D+Corner_A) / 2
[0058] Step 5: Combining quadtree structure and dynamic LOD terrain, a quadtree-based LOD terrain rendering algorithm is proposed, and a dynamic LOD algorithm is used to draw the terrain, so that each terrain block has a different level of detail and the terrain structure can be dynamically adjusted according to the distance of the viewpoint.
[0059] Each LOD terrain segment represents a quadtree, which initially contains only a root node. Before each frame's rendering process begins, the following checks are performed on all subtree nodes under the root node of the quadtree:
[0060] (1) Determine the straight-line distance between the center of each subtree node and the camera (viewpoint). If the distance is less than a certain threshold, the node is a node that can be further subdivided. For nodes that can be further subdivided, continue to calculate the four subtrees of the node and continue to make the same judgment for each subtree. If the distance is greater than the judgment threshold, it means that the node is already "far enough away" from the camera. At this time, the subtree of the node is no longer further subdivided. The node is marked as "renderable" and pushed into the rendering sequence.
[0061] (2) Simultaneously set the Level value of the terrain block. The rule for setting the Level value is: if the resolution of a terrain block is Res×Res, then the maximum Level value of the terrain block node is Level_max=log2(Res). Add another judgment condition, namely the Level value of the subtree, to limit the number of judgment operations: if the Level value of the subtree node is greater than or equal to the maximum node Level value under the terrain resolution, forcibly terminate the judgment operation and push the node into the rendering sequence.
[0062] Step Six: A double-queue approach is used to mitigate recursive operations. In each frame, the entire quadtree is traversed, determining the appropriate level for each node, thus dynamically partitioning the node hierarchy and reducing the time spent traversing the entire quadtree when it has too many levels. The method for mitigating recursion using the double-queue approach is as follows:
[0063] Two queues, A and B, are used to store the quadtree nodes. At the beginning of each frame, both queues A and B are empty. Then, the root node of the quadtree is added to queue A. The following operation is then performed on queues A and B until both A and B are empty:
[0064] First, queue A is checked. If A is not empty, each node in queue A is partitioned. If a node is partitionable, all its child nodes are pushed into queue B; if a node is not partitionable, it is pushed into the rendering sequence. After traversing all nodes in queue A, queue A is cleared. The same operation is then performed on queue B: each node in queue B is partitioned; if it is partitionable, all its child nodes are pushed into queue A; otherwise, it is pushed into the rendering sequence. After traversal, queue B is cleared, and the same operation is performed on queue A, and so on, until queues A and B are empty, completing the traversal of the entire quadtree.
[0065] Step 7: Add Hough coding attributes to each node, design an algorithm to quickly traverse the quadtree and access adjacent nodes. If the difference in the level of two adjacent nodes does not exceed 1, use edge deletion technology to delete the edge points bordering the node with the higher level between the two adjacent nodes, so as to solve the terrain crack problem caused by the quadtree structure.
[0066] Among them, such as Figure 6 As shown, for the root node, its Huffman code is set to 0, and the Huffman codes of all nodes begin with 0. The last bit of each node represents the number of times it belongs to its parent node, the second to last bit represents the number of times the parent node is in its parent's parent's parent node, the third to last bit represents the number of times the parent's parent is in its next higher-level parent node, and so on, completing the Huffman code assignment for each node. Then, a fast traversal is performed on the quadtree nodes. The fast traversal algorithm for quadtree nodes is implemented as follows:
[0067] (1) For each node, four unsigned int attributes are temporarily assigned: up, down, right, and left, representing the four directions of up, down, left, and right. The initial values of all of them are 0. The last number of the target node is directly derived from the last number of the existing nodes. For example, if the last number of a node is 3, then the last number of the node to its right is 0, and the last number of the node above it is 2.
[0068] (2) Traverse each Huffman code of the node: increment the direction of non-sibling nodes by 1. For example: if it is 0, increment up and left by 1; if it is 1, increment down and left by 1; if it is 2, increment down and right by 1; if it is 3, increment up and right by 1. Then, for each Huffman code of the node, find its largest direction value, and place the code value of the direction of the largest Huffman code value of that bit into the previous bit of the target node; continue this operation until all the Huffman codes of the node are completed. After obtaining the Huffman code of the target node, use the code of the node to directly obtain all the information of the node by traversing the quadtree.
[0069] After obtaining the layer information of all surrounding nodes, perform corresponding operations on the current node to eliminate cracks. For adjacent nodes in a certain direction, if their layer number is equal to or greater than the current node's layer number, no operation is performed; if the layer number of adjacent nodes in a certain direction is less than the current node's layer number, comment out the EdgePoint of the current node in the corresponding direction and do not render it (e.g., Figure 7 (Points A and B in the diagram) to eliminate cracks in that direction. For cases where adjacent nodes in multiple directions have different layer numbers, comment out the EdgePoint in the corresponding direction and do not render it, thus eliminating cracks in any direction.
Claims
1. A method for LOD terrain rendering and optimization based on a quadtree structure, characterized in that, Applications include: 3D graphics engine terrain rendering optimization Establish and initialize the quadtree structure. Given the original data of the root node and the number of levels in the quadtree, generate data for all nodes and assign various data required for rendering to each node of the quadtree. Combining quadtree structure and dynamic LOD terrain, a quadtree-based LOD terrain rendering algorithm is proposed, and a dynamic LOD algorithm is used to draw the terrain, so that each terrain block has a different level of detail and the terrain structure can be dynamically adjusted according to the distance of the viewpoint. A dual-queue approach is used instead of recursive operations. The entire quadtree is traversed in each frame to determine the level to which each node needs to be partitioned, thus achieving dynamic partitioning of node levels. Add Hough coding attributes to each node, design an algorithm to achieve fast traversal of the quadtree to access adjacent nodes, and then use edge deletion technology to delete the edge points that are adjacent to the node with the higher level between two adjacent nodes to solve the gap problem. To implement fast traversal of a quadtree to visit adjacent nodes, and to solve the gap problem by removing edge points bordering the higher-level node between two adjacent nodes using edge deletion techniques, the following methods are employed: Add Hough coding attributes to each node and design an algorithm to achieve fast traversal of the quadtree to access adjacent nodes. When the difference in the level of two adjacent nodes does not exceed 1, the edge point of the node with the higher level between the two adjacent nodes is deleted by edge deletion technique to solve the terrain crack problem caused by the quadtree structure. Set the root node's Huffman code to 0, and set the Huffman code of all nodes to start with 0; the last bit of each node represents the number of times it belongs to its parent node, the second to last bit represents the number of times the parent node belongs to its parent's parent, the third to last bit represents the number of times the parent's parent belongs to its next higher-level parent, and so on, completing the Huffman code assignment for each node. Then, perform a fast traversal of the quadtree nodes; the fast traversal algorithm for quadtree nodes is implemented as follows: (1) For each node, four unsigned int attributes up, down, right, and left are temporarily assigned to represent the four directions of up, down, left, and right, and the initial values of all are 0. The last number of the target node is directly obtained from the last number of the existing nodes. If the last number of a node is 3, then the last number of the node to its right is 0 and the last number of the node above it is 2. (2) Traverse each Huffman code of the node: increment the direction of non-sibling nodes by 1; if it is 0, increment up and left by 1; if it is 1, increment down and left by 1; if it is 2, increment down and right by 1; if it is 3, increment up and right by 1; then, for each Huffman code of the node, find its maximum direction value, and place the code value of the direction of the maximum value of the Huffman code of that bit into the previous bit of the target node; continue this operation until all the Huffman codes of the node are completed; after obtaining the Huffman code of the target node, use the code of the node to directly obtain all the information of the node by traversing the quadtree; After obtaining the layer information of all surrounding nodes, perform corresponding operations on the current node to eliminate cracks. For adjacent nodes in a certain direction, if the layer number is equal to or greater than the layer number of the current node, no operation is performed. If the layer number of adjacent nodes in a certain direction is less than the layer number of the current node, comment out the EdgePoint of the current node in the corresponding direction and do not render it, thus eliminating cracks in that direction. In the case where there are adjacent nodes with different layer numbers in multiple directions, comment out the EdgePoint of the corresponding direction and do not render it, thus eliminating cracks in any direction.
2. The method for LOD terrain rendering and optimization based on a quadtree structure according to claim 1, characterized in that: Establish a quadtree structure and initialize it, assigning various data required for rendering to each node of the quadtree, including: Establish and initialize a quadtree structure. Given the original data of the root node and the number of levels in the quadtree, generate data for all nodes and assign various data required for rendering to each node of the quadtree. The root node of the quadtree is set to a closed triangular sector consisting of eight triangles; the four vertices of the quadtree node are called CornerPoint0~3, the center points of the four sides of the quadtree node are called EdgePoint0~3, and the center point of the quadtree node is called CenterPoint; the rendering data of any node in the quadtree can be calculated from its parent node; the rendering data of the root node can be directly obtained from the grayscale image. Based on the given data of the root node of the quadtree, the child nodes are initialized level by level, and the data of all nodes in the quadtree is calculated. The calculation method is as follows: (1) The root node of the quadtree always corresponds to the edge of the entire terrain. In a terrain tile with a resolution of 256*256, the value of CornerPoint0 of the root node is the first vertex of the top left corner of the terrain, which is always 0; the value of CornerPoint1 of the root node is the vertex of the bottom left corner of the terrain, which is 256*(256-1) = 65280; the value of CornerPoint2 of the root node is the vertex of the bottom right corner of the terrain, which is 256*256-1 = 65535; the value of CornerPoint3 of the root node is the vertex of the top right corner of the terrain, which is the last number of the vertices in the first row: 255; the center point value of the root node and the center point value of the four edges are calculated based on the four vertex values of the root node to complete the initialization of the root node of the quadtree; the calculation method of the center point value of the root node and the center point value of the four edges is as follows: The center point value of the root node: CenterPoint=(CornerPoint0+CornerPoint2) / 2 The center values of the four edges of the root node: EdgePoint0=(CornerPoint0+CornerPoint1) / 2 EdgePoint1=(CornerPoint1+CornerPoint2) / 2 EdgePoint2=(CornerPoint2+CornerPoint3) / 2 EdgePoint3=(CornerPoint3+CornerPoint0) / 2 (2) After the root node is initialized, the child nodes are initialized, and the vertex values, center point values, and center point values of the four edges of the child nodes are calculated. The data of the child nodes can be calculated from their parent nodes, and the calculation method is as follows: The four vertex values of the child node are: Corner_A=CornerPoint0, Corner_B=EdgePoint0, Corner_C=CenterPoint, Corner_D=EdgePoint3. Then, the center point value of the child node and the center point values of the four edges are calculated similarly. Center point value of child node: Center = (Corner_A + Corner_C) / 2 The center point values of the four edges of the child node: Edge_A = (Corner_A + Corner_B) / 2 Edge_B = (Corner_B + Corner_C) / 2 Edge_C = (Corner_C + Corner_D) / 2 Edge_D=(Corner_D+Corner_A) / 2.
3. The method for LOD terrain rendering and optimization based on a quadtree structure according to claim 1, characterized in that: Combining quadtree structure and dynamic LOD terrain, a quadtree-based LOD terrain rendering algorithm is proposed, and a dynamic LOD algorithm is used to draw the terrain, enabling each terrain tile to have different levels of detail and a terrain structure that can dynamically adjust with the distance of the viewpoint, including: The terrain is rendered using a dynamic LOD algorithm, giving each terrain tile a different level of detail and allowing the terrain structure to dynamically adjust with the viewpoint's distance. Each LOD terrain tile represents a quadtree, which initially contains only the root node. Before each frame's rendering process begins, the following checks are performed on all subtree nodes under the root node of the quadtree: (1) Determine the straight-line distance between the center of each subtree node and the camera viewpoint. If the distance is less than a certain threshold, the node is a node that can be further subdivided. For nodes that can be further subdivided, continue to calculate the four subtrees of the node and continue to make the same judgment for each subtree. If the distance is greater than the judgment threshold, it means that the node is already "far enough away" from the camera. At this time, the subtree of the node will not be further subdivided. The node will be marked as "renderable" and pushed into the rendering sequence. (2) At the same time, set the Level value of the terrain block. The rule for setting the Level value is: if the resolution of a terrain block is Res×Res, then the maximum Level value of the terrain block node is Level_max=log2(Res); and add another judgment condition, namely the Level value of the subtree, to limit the number of judgment operations: if the Level value of the subtree node is greater than or equal to the maximum node Level value under the terrain resolution, the judgment operation is forcibly terminated and the node is pushed into the rendering sequence.
4. The method for LOD terrain rendering and optimization based on a quadtree structure according to claim 1, characterized in that: A dual-queue approach is used instead of recursive computation. The entire quadtree is traversed in each frame to determine the appropriate level for each node, thus achieving dynamic node level partitioning. This includes: Two queues, A and B, are used to store the quadtree nodes. At the beginning of each frame, both queues A and B are empty. Then, the root node of the quadtree is added to queue A. The following operation is then performed on queues A and B until both A and B are empty: First, queue A is checked. If A is not empty, each node in queue A is partitioned. If a node is partitionable, all its child nodes are pushed into queue B. If a node is not partitionable, it is pushed into the rendering sequence. After traversing all nodes in queue A, queue A is cleared. Then, the same operation is performed on queue B: each node in queue B is partitioned. If it is partitionable, all its child nodes are pushed into queue A; otherwise, it is pushed into the rendering sequence. After traversing, queue B is cleared, and the same operation is performed on queue A again. This process is repeated until there are no nodes in queues A and B, completing the traversal of the entire quadtree.