Disorder rendering method and device and medium

By defining unordered attributes for child nodes in the game node tree and using unordered stacks and rendering queues, the combined batch rendering of list item elements is automatically implemented, solving the high workload and high error rate problems caused by manual adjustment of node order. , improves game running performance and development efficiency.

CN119015695APending Publication Date: 2024-11-26XIAMEN LEITING INTERACTION NETWORK CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202410886822.8
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-07-03
Publication Date
2024-11-26

AI Technical Summary

Technical Problem

Combined batch rendering of list item nodes in game development usually requires manual adjustment of node order, resulting in large workloads for developers and high error rates, and is not suitable for large number of list items.

Method used

By defining unordered attributes for child nodes in the list item node tree, using the unordered stack and render queue, inserting the co-batchable rendering nodes into the co-batch queue, automatically implementing co-batch rendering between list item elements, reducing drawing command calls .

Benefits of technology

It improves game performance, reduces the problem of manual operation error rate and low development efficiency, realizes automatic batch rendering, and simplifies the development process.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119015695A_ABST
    Figure CN119015695A_ABST
Patent Text Reader

Abstract

The invention provides a disorder rendering method and device and a medium. The method comprises the steps of obtaining a list item node tree; expanding a disordered attribute for all nodes, of which the child nodes do not shield each other, in the node tree, and defining the nodes with the disordered attribute as disordered nodes; traversing the nodes, inserting rendering nodes which can be combined into the same combining queue, and inserting rendering nodes which cannot be combined into different combining queues; inserting the disordered nodes into a disordered stack until all child nodes of the disordered nodes are traversed, popping up the disordered nodes from the top of the stack, acquiring a start index of a father node of a rendering node from the disordered stack if the father node of the rendering node is the disordered node, and starting to search a batch queue which can be subjected to batch according to the start index of the father node of the rendering node; and traversing all the nodes, and sending rendering nodes to an engine according to a batch queue sequence to carry out batch merging rendering. According to the method, automatic batch processing of any non-shielding nodes can be realized, and the game rendering efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of image processing technology, and in particular to a disordered rendering method, device and medium. Background Art

[0002] There are many list items involved in game development, such as equipment lists, leaderboard lists, etc. List items will not block each other. The node elements in the list items may be very complex, but most list items will have the same layout structure, the same or similar background, etc. These elements have the same drawing commands and can be merged for batch rendering, but because the engine itself is rendered in the order of the node tree, the batching of different list item elements is usually interrupted. The existing method is mainly for developers to manually expand the nodes of the list items, flatten them into the container nodes, and then manually adjust the order of each node according to the batching rules. In this way, manually expanding the nodes achieves the purpose of batching to a certain extent and reduces the call of drawing commands, but it also greatly increases the workload of developers. Manual operation is not suitable for lists with a large number of numbers. In addition, since the hierarchical structure after the nodes are expanded is inconsistent with the actual logical structure, all logics that rely on parent-child relationships are unavailable, and the error rate is high. Summary of the invention

[0003] The technical problem to be solved by the present invention is to provide an out-of-order rendering method, which automatically realizes batching between list item elements, reduces the calling of a large number of drawing commands, and thus improves the game running performance.

[0004] In a first aspect, the present invention is implemented as follows: a disordered rendering method, the method comprising: Get a list item node tree, where the node tree includes rendering nodes and non-rendering nodes; Extend an unordered attribute to all nodes in the node tree whose child nodes do not block each other, define the nodes with unordered attributes as unordered nodes, and define the rendering nodes in the unordered nodes as unordered nodes; A rendering queue and an unordered stack are defined, wherein the rendering queue includes a plurality of batch queues, each batch queue is used to store at least one rendering node, and the unordered stack is used to store unordered nodes and their one-to-one corresponding start indexes, wherein the start index is a global start index used to search for the batch queue; Traverse the nodes, insert the render nodes that can be batched into the same batch queue, and insert the render nodes that cannot be batched into different batch queues; insert the unordered nodes into the unordered stack at the same time, until all the child nodes of the unordered node are traversed and the unordered node is popped from the top of the stack. For the render node whose parent node is an unordered node, get the start index of its parent node from the unordered stack, and start searching for the batch queue that can be batched according to the start index of its parent node; After traversing all nodes, multiple batch queues are obtained, and the rendering nodes are sent to the engine for merged batch rendering in the order of the batch queues. Furthermore, the judgment condition for batching is that nodes with the same drawing status are judged to be batchable, otherwise they are not batchable.

[0005] Furthermore, the process of traversing nodes is as follows: Step 1: traverse the node tree. When traversing to the current node, if the node is a direct child node of the nearest unordered node in the current unordered stack, reset the start index to the start index recorded in the current unordered stack for the unordered node; otherwise, the start index of the current node continues to use the previous start index; Step 2: Determine whether the current node is a rendering node. If so, go to step 3; otherwise, jump to step 4. Step 3, search the rendering queue according to the starting index. If a batch queue that can be batched is found, insert a into the batch queue, and modify the starting index to the index of the current queue. If not found, insert a new batch queue, insert the current node into the new batch queue, modify the starting index to the index of the current queue, and go to step 4. Step 4: Determine whether the current node is an unordered node. If so, push the current node and the current start index into the unordered stack. Otherwise, go to step 5. Step 5: If all child nodes of the parent node of the current node have been traversed and the parent node of the current node is an unordered node, pop the parent node of the current node from the top of the stack, otherwise, go to step 6; Step 6: Return to step 1 and continue traversing the nodes until all nodes are traversed.

[0006] In a second aspect, the present invention provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the processor implements the method described in the first aspect when executing the program.

[0007] In a third aspect, the present invention provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the method described in the first aspect.

[0008] The present invention has the following advantages: the present invention defines nodes whose child nodes do not occlude each other as unordered nodes, and by maintaining the unordered stack and the rendering queue, rearranges the nodes under the unordered nodes with other nodes to obtain a batch queue, and sends them to the engine in sequence according to the batch queue to realize automatic batch rendering, thereby improving the overall rendering efficiency of the game, while avoiding the problems of high error rate and low manual efficiency of manually expanding nodes, thereby improving the efficiency of game development. BRIEF DESCRIPTION OF THE DRAWINGS

[0009] The present invention will be further described below in conjunction with embodiments with reference to the accompanying drawings.

[0010] Figure 1 This is a flowchart of an execution of an out-of-order rendering method in Embodiment 1 of the present invention.

[0011] Figure 2 It is a schematic diagram of the structure of an electronic device in Embodiment 2 of the present invention.

[0012] Figure 3 Schematic diagram of the structure of the medium in the third embodiment of the present invention.

[0013] Figure 4 It is a schematic diagram of a node tree structure in a specific implementation manner of the present invention.

[0014] Figure 5 for Figure 4 Schematic diagram of the traversal state of node a.

[0015] Figure 6 for Figure 4 Schematic diagram of the traversal state of node b.

[0016] Figure 7 for Figure 4 Schematic diagram of the traversal state of node d.

[0017] Figure 8 for Figure 4 Schematic diagram of the traversal state of node f.

[0018] Fig. 9 for Figure 4 Schematic diagram of the traversal state of node g.

[0019] Fig.10 for Figure 4 State diagram of the unordered stack when the middle node d is popped.

[0020] Fig.11 for Figure 4 Schematic diagram of the traversal state of node e.

[0021] Fig.12 for Figure 4 Schematic diagram of the traversal state of node c. DETAILED DESCRIPTION

[0022] The present invention extends an unordered attribute on the inherent node and designs an unordered rendering stack and a start index algorithm, so that all nodes that do not occlude each other can be rendered out of sequence, and maintains a list of nodes that can be batched through a batch queue and sends it to the rendering engine for automatic batch rendering, thereby improving the overall rendering efficiency of the game.

[0023] Embodiment 1 See also Figure 1 As shown, the present invention provides a disordered rendering method, the method comprising: Get a list item node tree, where the node tree includes rendering nodes and non-rendering nodes; Extend an unordered attribute to all nodes in the node tree whose child nodes do not block each other, and define the nodes with unordered attributes as unordered nodes; A rendering queue and an unordered stack are defined, wherein the rendering queue includes a plurality of batch queues, each batch queue is used to store at least one rendering node, and the unordered stack is used to store unordered nodes and their one-to-one corresponding start indexes, wherein the start index is a global start index used to search for the batch queue; Traverse the nodes, insert the render nodes that can be batched into the same batch queue, and insert the render nodes that cannot be batched into different batch queues; insert the unordered nodes into the unordered stack at the same time, until all the child nodes of the unordered node are traversed and the unordered node is popped from the top of the stack. For the render node whose parent node is an unordered node, get the start index of its parent node from the unordered stack, and start searching for the batch queue that can be batched according to the start index of its parent node; After traversing all nodes, multiple batch queues are obtained, and the rendering nodes are sent to engines such as Cocos or Unity for merged batch rendering in the order of the batch queues. Preferably, the judgment condition for batching is that nodes with the same drawing state (for example, nodes rendered with the same image or texture) are judged to be batchable, otherwise they are not batchable.

[0024] Preferably, the process of traversing nodes is specifically as follows: Step 1: traverse the node tree. When traversing to the current node, if the node is a direct child node of the nearest unordered node in the current unordered stack, reset the start index to the start index recorded in the current unordered stack for the unordered node; otherwise, the start index of the current node continues to use the previous start index; Step 2: Determine whether the current node is a rendering node. If so, go to step 3; otherwise, jump to step 4. Step 3, search the rendering queue according to the starting index. If a batch queue that can be batched is found, insert a into the batch queue, and modify the starting index to the index of the current queue. If not found, insert a new batch queue, insert the current node into the new batch queue, modify the starting index to the index of the current queue, and go to step 4. Step 4: Determine whether the current node is an unordered node. If so, push the current node and the current start index into the unordered stack. Otherwise, go to step 5. Step 5: If all child nodes of the parent node of the current node have been traversed and the parent node of the current node is an unordered node, pop the parent node of the current node from the top of the stack, otherwise, go to step 6; Step 6: Return to step 1 and continue traversing the nodes until all nodes are traversed.

[0025] In order to more clearly illustrate the node traversal process of the present invention, Figures 4 to 12 Let's take an example: Give an example Figure 4 The node tree, wherein node a and node d are unordered nodes; First traverse node a; Since a is the first node, it is inserted into batch queue 0 of the rendering queue with a starting index of 0. Since a is an unordered node, a is also pushed into the unordered stack and the starting index is recorded as 0. Traverse to node b. Since its parent node is the unordered node a, the starting index of a is found to be 0 in the stack. Node b starts from the starting index 0 to find out whether there is a queue that can be batched. If it cannot be batched with node a, a new queue 1 is inserted, and node b is inserted into the batched queue 1. Traverse to node d, and start looking for queues that can be batched from the last starting index, that is, batch queue 1. If it can be batched with b, insert it into queue 1. At this time, the starting index is queue 1; Traverse to node f. Since its parent node is the unordered node d, the starting index is the starting index 1 of the unordered node b. If there is no batch queue, a new batch queue 2 is created, and node f is inserted into batch queue 2. The starting index is changed to 2. Traverse to node g. Since its parent node is the unordered node d, the starting index is the starting index 1 of the unordered node b. Therefore, start from batch queue 1 to find out whether there is a queue that can be batched. If it can be batched with f, insert it into queue 2 and change the starting index to 2. At this time, after traversing all direct child nodes of the unordered node d, the unordered node d is popped from the unordered stack; Continue to traverse node e, starting from the start index 2 to find whether there is a queue that can be batched. If there is a queue that can be batched, insert node e into queue 2; Traverse node c. Since its parent node is the unordered node a, the starting index is the starting index 0 of the unordered node a. Therefore, start from the batch queue 0 to find out whether there is a queue that can be batched. If it can be batched with node a, insert node c into queue 0, and change the starting index to index 0 of the insertion queue.

[0026] Based on the same inventive concept, the present application provides an electronic device embodiment corresponding to the first embodiment, see the second embodiment for details.

[0027] Embodiment 2 This embodiment provides an electronic device, such as Figure 2 As shown, it includes a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, any implementation method in the first embodiment can be implemented.

[0028] Since the electronic device introduced in this embodiment is a device used to implement the method in the first embodiment of the present application, based on the method introduced in the first embodiment of the present application, a person skilled in the art can understand the specific implementation of the electronic device of the present embodiment and its various variations, so how the electronic device implements the method in the embodiment of the present application is not described in detail here. As long as a person skilled in the art implements the device used by the method in the embodiment of the present application, it belongs to the scope of protection of the present application.

[0029] Based on the same inventive concept, the present application provides a storage medium corresponding to Example 1, see Example 3 for details.

[0030] Embodiment 3 This embodiment provides a computer-readable storage medium, such as Figure 3 As shown, a computer program is stored thereon, and when the computer program is executed by a processor, any implementation method in Example 1 can be implemented.

[0031] The above method of the present invention can realize automatic batch processing before sending to the engine, which is convenient for development. If all child nodes of a node do not block each other, an unordered rendering attribute can be added to the node to reduce drawing commands. By maintaining the unordered rendering queue in a stack manner, nesting of unordered nodes can be realized, without additional restrictions on developers, thereby improving game development efficiency and game rendering efficiency.

[0032] Although the specific implementation modes of the present invention are described above, those skilled in the art should understand that the specific implementation modes described are only illustrative and are not intended to limit the scope of the present invention. Equivalent modifications and changes made by those skilled in the art in accordance with the spirit of the present invention should be included in the scope of protection of the claims of the present invention.

Claims

1. A disordered rendering method, characterized in that: The method comprises: Get a list item node tree, where the node tree includes rendering nodes and non-rendering nodes; Extend an unordered attribute to all nodes in the node tree whose child nodes do not block each other, and define the nodes with unordered attributes as unordered nodes; A rendering queue and an unordered stack are defined, wherein the rendering queue includes a plurality of batch queues, each batch queue is used to store at least one rendering node, and the unordered stack is used to store unordered nodes and their one-to-one corresponding start indexes, wherein the start index is a global start index used to search for the batch queue; Traverse the nodes, insert the render nodes that can be batched into the same batch queue, and insert the render nodes that cannot be batched into different batch queues; insert the unordered nodes into the unordered stack at the same time, until all the child nodes of the unordered node are traversed and the unordered node is popped from the top of the stack. For the parent node of the render node that is an unordered node, get the start index of its parent node from the unordered stack, and start searching for the batch queue that can be batched according to the start index of its parent node; After traversing all nodes, multiple batch queues are obtained, and the rendering nodes are sent to the engine for merged batch rendering in the order of the batch queues.

2. The out-of-order rendering method according to claim 1, characterized in that: The judgment condition for batching is that nodes with the same drawing status are judged to be batchable, otherwise they are not batchable.

3. The out-of-order rendering method according to claim 1, characterized in that: The process of traversing nodes is as follows: Step 1: traverse the node tree. When traversing to the current node, if the node is a direct child node of the nearest unordered node in the current unordered stack, reset the start index to the start index recorded in the current unordered stack for the unordered node; otherwise, the start index of the current node continues to use the previous start index; Step 2: Determine whether the current node is a rendering node. If so, go to step 3; otherwise, jump to step 4. Step 3, search the rendering queue according to the starting index. If a batch queue that can be batched is found, insert a into the batch queue, and modify the starting index to the index of the current queue. If not found, insert a new batch queue, insert the current node into the new batch queue, modify the starting index to the index of the current queue, and go to step 4. Step 4: Determine whether the current node is an unordered node. If so, push the current node and the current start index into the unordered stack. Otherwise, go to step 5. Step 5: If all child nodes of the parent node of the current node have been traversed and the parent node of the current node is an unordered node, pop the parent node of the current node from the top of the stack, otherwise, go to step 6; Step 6: Return to step 1 and continue traversing the nodes until all nodes are traversed.

4. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that: When the processor executes the program, the method according to any one of claims 1 to 3 is implemented.

5. A computer-readable storage medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 3 is implemented.