Target object rendering method and device, equipment, medium and program product

By using the dual retrieval method of target octree and target hierarchical box tree in complex 3D scenes, the problem of low rendering efficiency in the prior art is solved, and fast and accurate rendering of large-scale targets is achieved.

CN119648886APending Publication Date: 2025-03-18CHENGDU GONGDING TECHNOLOGY CO LTD +2
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411822377.5
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-12-11
Publication Date
2025-03-18

AI Technical Summary

Technical Problem

The prior art can easily lead to software lag and rendering efficiency in large-scale target batch pickup operations in complex 3D scenarios.

Method used

Through the dual search method based on the target octree and the target hierarchical box tree, objects in the scene are quickly retrieved and rendered, and the target objects are achieved quickly and accurately rendered.

Benefits of technology

Improve rendering efficiency, reduce the possibility of software lag, and achieve fast and accurate batch pickup of large-scale targets in complex 3D scenes.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119648886A_ABST
    Figure CN119648886A_ABST
Patent Text Reader

Abstract

The invention provides a target object rendering method and device, equipment, a medium and a program product, and the method comprises the steps: obtaining a target to-be-rendered region in a scene, carrying out the spatial indexing of the nodes of a target hierarchical bounding box tree based on the nodes of a target octree, namely target octree nodes, which are partially or completely located in the target to-be-rendered region, the method comprises the following steps of: obtaining target layer bounding box tree nodes, namely, target layer bounding box tree nodes partially or completely located in target octree nodes, determining an object located in a target to-be-rendered area in the target layer bounding box tree nodes as a target object, and rendering the target object to obtain a rendering result. Therefore, through the structure of the octree and the hierarchical bounding box tree, double retrieval can be performed on the object located in the target to-be-rendered area in the scene, the target object in the target to-be-rendered area is rapidly determined, the rendering task of the target to-be-rendered area is rapidly and accurately completed, and the rendering efficiency is effectively improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of graphics processing technology, and in particular to a method, device, equipment, medium and program product for rendering a target object. Background Art

[0002] As CAD and CAE software have increasingly more requirements for interactive graphics rendering, batch picking has become a common requirement for graphics processing. Software users need to batch pick targets, i.e., rendering elements, in the scene by clicking and dragging the mouse to select a box in the graphics interface. However, batch picking of targets, especially large-scale batch picking of targets in complex 3D scenes, can easily cause software freezes.

[0003] In the prior art, fuzzy searches are usually performed through bounding boxes or bounding spheres, which have low accuracy. Alternatively, all vertices in the scene are analyzed one by one, which is labor-intensive, slow, and requires extremely high CPU resources, thus resulting in low rendering efficiency. Summary of the invention

[0004] Based on the defects and shortcomings of the above-mentioned prior art, the present application proposes a target object rendering method, device, equipment, medium and program product, which can perform double retrieval of objects in the scene based on the nodes of the target octree obtained by scene division and the nodes of the target hierarchical bounding box tree, determine the target object, and render the target object to obtain a rendering result, thereby realizing rapid retrieval of the target object and completing the rendering of the target object, thereby solving the problem of low rendering efficiency.

[0005] According to a first aspect of the present application, a method for rendering a target object is provided, comprising:

[0006] Get the target area to be rendered in the scene;

[0007] Based on the target octree node, spatially indexing the nodes of the target hierarchical bounding box tree to obtain a target hierarchical bounding box tree node, wherein the target octree node is a node of the target octree that is partially or entirely located in the target area to be rendered, and the target octree is obtained by dividing the scene based on the octree structure, and the target hierarchical bounding box tree node is a node of the target hierarchical bounding box tree that is partially or entirely located in the target octree node, and the target hierarchical bounding box tree is obtained by dividing the scene based on the hierarchical bounding box tree structure;

[0008] Determine the object located in the target to-be-rendered area in the target hierarchical bounding box tree node as the target object;

[0009] The target object is rendered to obtain a rendering result.

[0010] According to a second aspect of the present application, a target object rendering device is provided, comprising:

[0011] An acquisition module is used to acquire the target area to be rendered in the scene;

[0012] An indexing module is used to spatially index the nodes of the target hierarchical bounding box tree based on the target octree node to obtain the target hierarchical bounding box tree node, wherein the target octree node is a node of the target octree that is partially or completely located in the target area to be rendered, and the target octree is obtained by dividing the scene based on the octree structure, and the target hierarchical bounding box tree node is a node of the target hierarchical bounding box tree that is partially or completely located in the target octree node, and the target hierarchical bounding box tree is obtained by dividing the scene based on the hierarchical bounding box tree structure;

[0013] A determination module, used for determining an object in the target hierarchical bounding box tree node located within the target to-be-rendered area as a target object;

[0014] The rendering module is used to render the target object to obtain a rendering result.

[0015] According to a third aspect of the present application, there is provided an electronic device, including a memory and a processor;

[0016] The memory is connected to the processor and is used to store programs;

[0017] The processor is used to implement the target object rendering method as described in the first aspect by running the program in the memory.

[0018] According to a fourth aspect of the present application, a storage medium is provided, on which a computer program is stored. When the computer program is executed by a processor, the target object rendering method as described in the first aspect is implemented.

[0019] According to a fifth aspect of the present application, a computer program product is provided, wherein the computer program product includes computer program instructions, and when the computer program instructions are executed by a processor, the processor implements the target object rendering method as described in the first aspect.

[0020] In the above-mentioned target object rendering method, device, equipment, medium and program product, the target area to be rendered in the scene can be obtained, and based on the nodes of the target octree that are partially or entirely located in the target area to be rendered, that is, the target octree nodes, the nodes of the target hierarchical bounding box tree are spatially indexed to obtain the target hierarchical bounding box tree nodes, that is, the nodes of the target hierarchical bounding box tree that are partially or entirely located in the target octree nodes, and then the objects in the target hierarchical bounding box tree nodes that are located in the target area to be rendered are determined as the target objects, and the target objects are rendered to obtain the rendering results. In this way, through the structure of the octree and the hierarchical bounding box tree, the objects in the target area to be rendered in the scene can be double-searched, the target objects in the target area to be rendered can be quickly determined, and the rendering task of the target area to be rendered can be quickly and accurately completed, effectively improving the rendering efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0021] In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings required for use in the embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on the provided drawings without paying any creative work.

[0022] Figure 1 A schematic diagram of a process of a target object rendering method provided in an embodiment of the present application;

[0023] Figure 2 A schematic diagram of a target area to be rendered provided in an embodiment of the present application;

[0024] Figure 3 A schematic diagram of the structure of an octree provided in an embodiment of the present application;

[0025] Figure 4 A schematic diagram of the structure of a hierarchical bounding box tree proposed in an embodiment of the present application;

[0026] Figure 5 A schematic diagram of a target object rendering process proposed in an embodiment of the present application;

[0027] Figure 6 A schematic diagram of the structure of a target object rendering device proposed in an embodiment of the present application;

[0028] Figure 7 A schematic diagram of the structure of an electronic device proposed in an embodiment of the present application. DETAILED DESCRIPTION

[0029] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0030] Overview

[0031] As described in the background technology, with the increasingly rich requirements of CAD and CAE software for graphics rendering interaction, batch picking has become a routine requirement for graphics processing. The user of the software needs to click and drag the mouse to select boxes and other interactive methods in the graphics operation interface to batch pick the targets in the scene, i.e., rendering elements. However, the batch picking operation of targets, especially the batch picking operation of targets in a large range under complex 3D scenes, easily causes the software to freeze. In the prior art, fuzzy searches are usually performed through bounding boxes and bounding spheres, with low accuracy, or, by analyzing all vertices in the scene one by one, the workload is large, the speed is slow, and the CPU resource requirements are extremely high. Therefore, the efficiency of batch picking of targets is low, which leads to low rendering efficiency.

[0032] On this basis, the inventors found through further research that the target area to be rendered in the scene is obtained, and based on the nodes of the target octree that are partially or entirely located in the target area to be rendered, that is, the target octree nodes, the nodes of the target hierarchical bounding box tree are spatially indexed to obtain the target hierarchical bounding box tree nodes, that is, the nodes of the target hierarchical bounding box tree that are partially or entirely located in the target octree nodes, and then the objects in the target hierarchical bounding box tree nodes that are located in the target area to be rendered are determined as the target objects, and the target objects are rendered to obtain the rendering results. In this way, through the structure of the octree and the hierarchical bounding box tree, the objects in the target area to be rendered in the scene can be double-searched, the target objects in the target area to be rendered can be quickly determined, and the rendering task of the target area to be rendered can be quickly and accurately completed, effectively improving the rendering efficiency.

[0033] Based on the above concept, an embodiment of the present specification provides a method for rendering a target object, which will be described exemplarily in conjunction with the accompanying drawings below.

[0034] Exemplary Methods

[0035] See also Figure 1 In an exemplary embodiment, a target object rendering method is provided, which is applied to any electronic device, and the electronic device can obtain a target area to be rendered in a scene, screen objects in the scene to determine the target object, and render the target object. Figure 1As shown, the target object rendering method includes steps S101-S104:

[0036] S101: Acquire a target area to be rendered in a scene.

[0037] The scene is a 3D scene that needs to be rendered, and the target area to be rendered is a specific area in the scene that needs to be rendered.

[0038] After the initial loading of the scene is completed, the target area to be rendered is determined from the loaded scene.

[0039] Specifically, the target area to be rendered in the scene may be determined based on the parameters of the camera that captures the scene and the frame selection range of the scene.

[0040] The selection range is a rectangular area selected by the user by clicking and dragging the mouse in the operation interface, or a rectangular area represented by the upper left corner position and the upper right corner position of the rectangle directly input by the user.

[0041] For example, the interface of the selection range can be designed as Intersect(leftTopPoint: Vector1, rightBottomPoint: Vector2, callback). Intersect() is a function used to find the intersection between two objects, leftTopPoint: Vector1 represents the coordinates of the top left corner of the selection range as Vector1, rightBottomPoint: Vector2 represents the coordinates of the bottom right corner of the selection range as Vector1, and callback is used to return the selected geometric data, that is, the coordinates of the top left corner and the bottom right corner.

[0042] In actual business, the interface can be directly called according to the scene requirements, or the position on the screen can be converted into a rectangle described by the upper left corner and the lower right corner to obtain the selected geometric data, thereby ensuring the flexibility of the actual business.

[0043] For example, the target area to be rendered may be as follows: Figure 2 As shown, in the world coordinate system, the viewing frustum corresponding to the camera is determined, and the area to be rendered in the scene is determined in combination with the frame selection range. The frame selection range is circled by the front and back clipping planes, the upper and lower clipping planes, and the upper and lower clipping planes (the lower clipping plane, the left clipping plane, and the rear clipping plane are not shown).

[0044] S102: Based on the target octree node, perform spatial indexing on the nodes of the target hierarchical bounding box tree to obtain the target hierarchical bounding box tree node.

[0045] The target octree node is a node of the target octree that is partially or completely located in the target area to be rendered, and the target octree is obtained by dividing the scene based on the octree structure.

[0046] Specifically, based on the spatial range of the target octree node and the spatial range of the target area to be rendered, the overlap between the target octree node and the spatial range of the target area to be rendered is determined, and based on the overlap, the target octree node is determined.

[0047] If the spatial range of the node of the target octree completely or partially overlaps with the spatial range of the target area to be rendered, the node is determined to be the target octree node; if the spatial range of the node of the target octree does not overlap with the spatial range of the target area to be rendered at all, the node is discarded, that is, the node is not used as the target octree node.

[0048] Among them, the spatial range of the nodes of the target octree completely overlaps with the spatial range of the target area to be rendered, that is, the spatial range of the nodes of the target octree is completely within the spatial range of the target area to be rendered; the spatial range of the nodes of the target octree partially overlaps with the spatial range of the target area to be rendered, that is, the spatial range of the nodes of the target octree is partially within the spatial range of the target area to be rendered.

[0049] It should also be noted that before executing step S102, it is necessary to establish an independent thread to construct the target octree after the scene is initialized and loaded. Before constructing the target octree, the data structure of the node of the target octree must be defined first. Generally, a node includes a bounding box, an object list, a child node, etc., wherein the bounding box is used to define the spatial range of the node, the object list is used to store information such as identification of the object in the node, and the child node is used to point to the reference of the eight child nodes of the node. Among them, the object refers to the object, and the information of the object in the node is the information of the object contained in the spatial range of the node.

[0050] In addition, the octree is a recursively partitioned three-dimensional space data structure, which is mainly used for static segmentation of scenes. Each internal node of the octree has eight child nodes. If it is not an empty tree, any node in the tree will have exactly eight or zero child nodes, and there will be no other number of child nodes. In the octree, each node represents a volume element of a cube, and these volume elements are grouped together at the parent node.

[0051] For example, the structure of the octree can be as follows Figure 3As shown, the root node a corresponds to the spatial range A, and the root node a is divided into 8 child nodes, namely a1-a8, and the spatial ranges of these 8 child nodes are A1-A8. The 8 nodes a1-a8 can be further divided into 8 child nodes each. For example, a3 can be further divided into 8 nodes, namely a31-a38, and the corresponding spatial ranges are A31-A38. A7 can be further divided into 8 nodes, namely a71-a78, and the corresponding spatial ranges are A71-A78.

[0052] The target hierarchical bounding box tree node is a node of the target hierarchical bounding box tree that is partially or completely located in the target octree node, and the target hierarchical bounding box tree is obtained by dividing the scene based on the hierarchical bounding box tree structure.

[0053] Specifically, based on the spatial range of the node of the target hierarchical bounding box tree and the spatial range of the target octree node, the overlap of the spatial range of the node of the target hierarchical bounding box tree and the target octree node is determined, and based on the overlap, the target hierarchical bounding box tree node is determined.

[0054] If the spatial range of the node of the target hierarchical bounding box tree completely or partially overlaps with the spatial range of the target octree node, the node is determined to be the target hierarchical bounding box tree node; if the spatial range of the node of the target hierarchical bounding box tree does not overlap with the spatial range of the target octree node at all, the node is discarded, that is, the node is not used as the target hierarchical bounding box tree node.

[0055] Among them, the spatial range of the nodes of the target hierarchical bounding box tree completely overlaps with the spatial range of the target octree nodes, that is, the spatial range of the nodes of the target hierarchical bounding box tree is completely located within the spatial range of the target octree nodes; the spatial range of the nodes of the target octree partially overlaps with the spatial range of the target area to be rendered, that is, the spatial range of the target octree nodes is partially located within the spatial range of the target area to be rendered.

[0056] It should also be noted that before executing step S102, it is also necessary to establish an independent thread to construct the target level bounding box tree after the scene is initialized and loaded. Before constructing the target level bounding box tree, it is necessary to define the data structure of the node of the target level bounding box tree. Generally, the node includes a bounding box, an object list, a child node and other parts, wherein the bounding box is used to define the spatial range of the node, the object list is used to store information such as identification of the object in the node, and the child node is used to point to the reference of the two child nodes of the node.

[0057] In addition, the hierarchical bounding box tree is a data structure used for space segmentation and scene management. It is a multi-branch tree used to store bounding box shapes. Its root node represents a maximum bounding box, and its child nodes represent multiple sub-bounding boxes. In order to unify the shape of the hierarchical bounding box tree, it can usually only store the same bounding box shape, such as axis-aligned bounding box (AABB).

[0058] For example, taking a hierarchical bounding box tree divided into three levels as an example, the structure of the hierarchical bounding box tree can be as follows: Figure 4 As shown, the root node E is divided into node A and node F. Node A meets the restriction condition for leaf nodes, while node F does not meet the restriction condition for leaf nodes. For example, the restriction condition is that the number of objects in the node does not exceed 6. Therefore, node A is a leaf node and node F is a non-leaf node. Node F is further divided into node B and node G. Node B meets the restriction condition for leaf nodes, while node G does not meet the restriction condition for leaf nodes. Therefore, node B is a leaf node and node G is a non-leaf node. Node G is further divided into node C and node D. Both nodes C and node D meet the restriction condition for leaf nodes. Therefore, both nodes C and node D are leaf nodes, and no further division is performed on nodes C and D.

[0059] The bottom leaf node in the hierarchical bounding box tree directly points to the actual target to be rendered, and the non-leaf node points to the target to be rendered pointed to by its child node. Each node itself has an AABB hierarchical bounding model, that is, each node represents an AABB bounding box.

[0060] It is understandable that the above-mentioned spatial range can be represented by coordinates, and the overlap of the spatial range of the nodes of the octree and the nodes of the hierarchical bounding box tree, and the overlap of the spatial range of the nodes of the octree and the area to be rendered can be determined by analyzing and calculating the coordinates.

[0061] S103: Determine the object located in the target to-be-rendered area in the target hierarchical bounding box tree node as the target object.

[0062] Specifically, an object in the target hierarchical bounding box tree node that is partially or completely located in the target to-be-rendered area is determined as the target object.

[0063] Accordingly, the object located outside the target to-be-rendered area in the target hierarchical bounding box tree node is discarded, that is, the object is not determined as the target object.

[0064] Among them, the object that is partially located in the target area to be rendered in the target hierarchy bounding box tree node, that is, part of the spatial range of the object is located in the spatial range of the target area to be rendered, and the other part is located outside the spatial range of the target area to be rendered. The object that is completely located in the target area to be rendered in the target hierarchy bounding box tree node, that is, the spatial range of the object is completely located in the spatial range of the target area to be rendered.

[0065] S104: Render the target object to obtain a rendering result.

[0066] In this embodiment, by obtaining the target area to be rendered in the scene, based on the nodes of the target octree that are partially or entirely located in the target area to be rendered, that is, the target octree nodes, the nodes of the target hierarchical bounding box tree are spatially indexed to obtain the target hierarchical bounding box tree nodes, that is, the nodes of the target hierarchical bounding box tree that are partially or entirely located in the target octree nodes, and then the objects in the target hierarchical bounding box tree nodes that are located in the target area to be rendered are determined as the target objects, and the target objects are rendered to obtain the rendering results. In this way, through the structure of the octree and the hierarchical bounding box tree, the objects in the target area to be rendered in the scene can be double-searched, the target objects in the target area to be rendered can be quickly determined, and the rendering task of the target area to be rendered can be quickly and accurately completed, effectively improving the rendering efficiency.

[0067] In order to quickly select the target object, in some embodiments, based on the target octree node, the nodes of the target hierarchical bounding box tree are spatially indexed. When the target hierarchical bounding box tree node is obtained, the target hierarchical bounding box tree node is determined based on the spatial indexing of the non-leaf nodes of the target hierarchical bounding box tree by the target octree node.

[0068] Specifically, based on the target octree node, the non-leaf nodes of the target hierarchical bounding box tree are spatially indexed to determine the non-leaf nodes of the target hierarchical bounding box tree that are partially or completely located in the target octree node, and based on the non-leaf nodes, the target hierarchical bounding box tree node is determined.

[0069] Accordingly, non-leaf nodes of the target hierarchical bounding box tree other than the non-leaf nodes of the target hierarchical bounding box tree that are partially or completely located in the target octree node are determined, that is, non-leaf nodes of the target hierarchical bounding box tree that are not located in the target octree node, and the non-leaf nodes are discarded.

[0070] That is, based on the spatial range of the target octree node and the spatial range of the non-leaf nodes of the target hierarchical bounding box tree, determine the non-leaf nodes whose spatial ranges partially or completely overlap with the spatial range of the target octree node, and determine the target hierarchical bounding box tree node based on the non-leaf nodes. Accordingly, the nodes of the target hierarchical bounding box tree whose spatial ranges are outside the spatial range of the target octree node are discarded.

[0071] Since all the non-leaf nodes of the target hierarchical bounding box tree are located in the target octree node, all objects pointed to by the lower nodes representing the non-leaf nodes are located in the spatial range of the target octree node, but some of the non-leaf nodes of the target hierarchical bounding box tree are located in the target octree node, and some of the lower nodes representing the non-leaf nodes may point to objects that are located in the spatial range of the target octree, while some of the objects pointed to by the nodes are not located in the spatial range of the target octree node. If the non-leaf nodes of the target hierarchical bounding box tree that are partially or completely located in the spatial range of the target octree node are directly determined as the target hierarchical bounding box tree nodes, it may happen that the objects pointed to by the lower nodes of the target hierarchical bounding box tree nodes do not actually exist in the target area to be rendered.

[0072] Therefore, when indexing the nodes of the target hierarchical bounding box tree based on the target octree node, firstly, spatially index the non-leaf nodes of the target hierarchical bounding box tree based on the target octree node, and determine the non-leaf nodes of the target hierarchical bounding box tree that are all located in the target octree node as the first hierarchical bounding box tree nodes, and / or, determine the non-leaf nodes of the target hierarchical bounding box tree that are partially located in the target octree node as the second hierarchical bounding box tree nodes. Then, determine the first hierarchical bounding box tree node as the target hierarchical bounding box tree node, and / or, determine the target hierarchical bounding box tree node based on the lower node information of the second hierarchical bounding box tree node.

[0073] That is to say, when spatially indexing the non-leaf nodes of the target hierarchical bounding box tree based on the target octree node, for any non-leaf node, if the non-leaf node is entirely located in the target octree node, the non-leaf node is determined as a first-level bounding box tree node, and the first-level bounding box tree node is determined as the target hierarchical bounding box tree node; if the non-leaf node is partially located in the target octree node, the non-leaf node is determined as a second-level bounding box tree node, and based on the lower-level node information of the second-level bounding box tree node, the target hierarchical bounding box tree node is determined.

[0074] Accordingly, for any non-leaf node, if the non-leaf node is not located at the target octree node, the non-leaf node is discarded.

[0075] In this embodiment, based on the target octree node, the non-leaf nodes of the target hierarchical bounding box tree are spatially indexed, and all the non-leaf nodes of the target hierarchical bounding box tree located in the target octree node are determined as the target hierarchical bounding box tree nodes, and based on the lower node information of the non-leaf nodes of the target hierarchical bounding box tree that are partially located in the target octree node, the target hierarchical bounding box tree node is determined. In this way, based on the target octree node, the non-leaf nodes in the target hierarchical bounding box tree that are not located in the target octree node can be quickly eliminated, thereby realizing the rapid elimination of a large number of objects that are not located in the target area to be rendered in the scene, and the rapid selection of the target objects that are located in the target area to be rendered in the scene.

[0076] In order to quickly select the target object, in some embodiments, when determining the target level bounding box tree node based on the lower level node information of the second level bounding box tree node, the lower level nodes of the second level bounding box tree node are spatially indexed based on the target octree node, and the target level bounding box tree node is determined based on the spatial index situation.

[0077] Since the second-level bounding box tree node is a non-leaf node of the target level bounding box tree that is partially located within the target octree node, the lower-level information node of the second-level bounding box tree node represents that the second-level bounding box tree node has lower-level nodes, including the identifier, spatial range and object list of the lower-level nodes of the second-level bounding box tree node.

[0078] Specifically, based on the target octree node, the lower nodes of the second level bounding box tree node are spatially indexed to determine the lower nodes partially or completely located at the target octree node, and based on the lower nodes, the target level bounding box tree node is determined.

[0079] Accordingly, other lower-level nodes except for the lower-level nodes partially or completely located in the target octree node, that is, the lower-level nodes not located in the target octree node, are determined and discarded.

[0080] That is, based on the spatial range of the target octree node and the spatial range of the lower-level nodes, determine the lower-level nodes whose spatial ranges partially or completely overlap with the spatial range of the target octree node, and based on the lower-level nodes, determine the target hierarchical bounding box tree node. Accordingly, discard the lower-level nodes whose spatial ranges are outside the spatial range of the target octree node.

[0081] Since all lower-level nodes are located in the target octree node, it indicates that all objects pointed to by the lower-level nodes are located in the spatial range of the target octree node, but part of the lower-level nodes are located in the target octree node, which indicates that some objects pointed to by some nodes in the lower-level nodes of the lower-level nodes may be located in the spatial range of the target octree, and some objects pointed to by some nodes are not located in the spatial range of the target octree node. If the lower-level nodes that are partially or completely located in the spatial range of the target octree node are directly determined as the target hierarchical bounding box tree nodes, it may happen that the objects pointed to by the lower-level nodes of the target hierarchical bounding box tree nodes do not actually exist in the target area to be rendered.

[0082] Therefore, when indexing the lower nodes based on the target octree node, the lower nodes are first spatially indexed based on the target octree node, and all the lower nodes located in the target octree node are determined as new first-level bounding box tree nodes, and / or, some of the lower nodes located in the target octree node are determined as new second-level bounding box tree nodes. Then the new first-level bounding box tree node is determined as the target-level bounding box tree node, and / or, based on the lower-level node information of the new second-level bounding box tree node, the target-level bounding box tree node is determined, until the new second-level bounding box tree node has no lower-level nodes, or the (more) lower-level nodes of the new second-level bounding box tree node are all located in the target octree node.

[0083] That is to say, when spatially indexing the lower-level nodes based on the target octree node, for any lower-level node, if the lower-level node is entirely located in the target octree node, the lower-level node is determined as a new first-level bounding box tree node, and the new first-level bounding box tree node is determined as the target level bounding box tree node; if the lower-level node is partially located in the target octree node, the lower-level node is determined as a new second-level bounding box tree node, and based on the lower-level node information of the new second-level bounding box tree node, the target level bounding box tree node is determined, until the lower-level node has no lower-level nodes, or the lower-level nodes of the new second-level bounding box tree node are all located in the target octree node.

[0084] Accordingly, for any lower-level node, if the lower-level node is not located at the target octree node, the lower-level node is discarded.

[0085] Exemplarily, the target octree node is determined to be node S of the target octree. If node S contains two BVH nodes, namely node A and node B, based on the spatial range of node S and the spatial range of node A and node B, if node S contains node B, that is, the spatial range of node B is within the spatial range of node S, then node B is determined to be the target hierarchical bounding box tree node; if node S partially contains node A, it is determined whether node A has further split nodes.

[0086] If node A has no child nodes obtained by further splitting, that is, node A is a leaf node of the target hierarchical bounding box tree, node A is determined to be the target hierarchical bounding box tree node; if node A has nodes obtained by further splitting, including node C and node D, that is, node A is not a leaf node of the target hierarchical bounding box tree, determine whether the spatial ranges of node C and node D are all within the spatial range of the target octree node. If not, continue to determine whether node C and node D are target hierarchical bounding box tree nodes. If so, determine node C and node D as target hierarchical bounding box tree nodes.

[0087] In this embodiment, based on the target octree node, the lower nodes of the second-level bounding box tree are spatially indexed, and all the lower nodes of the second-level bounding box tree located in the target octree node are determined as the target-level bounding box tree node, and the target-level bounding box tree node is determined based on the lower-level node information of the lower nodes of the target-level bounding box tree that are partially located in the target octree node. In this way, based on the target octree node, non-leaf nodes in each level of the target-level bounding box tree that are not located in the target octree node can be further quickly eliminated, thereby realizing the rapid elimination of a large number of objects that are not located in the target area to be rendered in the scene, and the rapid selection of target objects that are located in the target area to be rendered in the scene.

[0088] In order to implement the spatial indexing between the nodes of the target octree, including the target octree nodes, and the nodes of the target hierarchical bounding box tree, in some embodiments, before performing the spatial indexing, a spatial indexing relationship between the nodes of the target octree and the nodes of the target hierarchical bounding box tree may be established.

[0089] The spatial index relationship is the spatial position relationship between the nodes of the target octree and the nodes of the target hierarchical bounding box tree.

[0090] Based on whether the spatial range of the nodes of the target octree coincides with the spatial range of the nodes of the target hierarchical bounding box tree, a spatial index relationship between the nodes of the target octree and the nodes of the target hierarchical bounding box tree is established.

[0091] For any node of the target octree, if the spatial range of the node of the target octree partially or completely overlaps with the spatial range of the node of the target hierarchical bounding box tree, that is, the spatial range of the node of the target hierarchical bounding box tree is partially or completely located within the spatial range of the node of the target octree, a spatial index relationship between the node of the target octree and the node of the target hierarchical bounding box tree is established. At this time, based on the spatial index relationship and the node of the target octree, the node of the target hierarchical bounding box tree can be indexed.

[0092] Since the spatial range of the node of the target octree may partially overlap with the spatial range of the node of the target hierarchical bounding box tree, the spatial range of the same node in the target hierarchical bounding box tree may partially overlap with the spatial range of multiple nodes at the same level in the target octree. Therefore, the spatial range of the same node in the target hierarchical bounding box tree may be located in the spatial range of a node at the previous level of the multiple nodes at the same level in the target octree. At this time, a spatial index relationship between a node at the previous level of the multiple nodes at the same level in the target octree and the same node in the target hierarchical bounding box tree can be established.

[0093] If the spatial range of the same node in the target hierarchical bounding box tree is located in the spatial range of at least two nodes of the upper level of the multiple nodes of the same level in the target octree, and these at least two nodes belong to the same upper-level node, then a spatial index relationship is established between the same node in the target hierarchical bounding box tree and the upper-level nodes of the at least two nodes of the target octree.

[0094] For example, Figure 3 For example, for the spatial range of node c in the target hierarchical bounding box tree and the spatial range of each node in the target octree, the spatial range of node c is simultaneously in the spatial range of nodes a31-a32 and nodes a74-a76 in the target octree, the upper node of nodes a31-a32 is node a3, which is obtained by dividing node a3, the upper node of nodes a74-a76 is node a7, which is obtained by dividing node a7, and the upper node of nodes a3 and a7 is node a, which is obtained by dividing node a. Therefore, a spatial index relationship between node a and node c is established.

[0095] In this way, based on whether the spatial range of the nodes of the target octree coincides with the spatial range of the nodes of the target hierarchical bounding box tree, a spatial index relationship between the nodes of the target octree and the nodes of the target hierarchical bounding box tree is established. When the nodes of the target hierarchical bounding box tree are spatially indexed based on the target octree nodes, the target hierarchical bounding box tree nodes can be quickly indexed, thereby quickly determining the target object located in the target area to be rendered.

[0096] In order to improve the efficiency of picking up rendering targets, in some embodiments, when the target object is rendered and the rendering result is obtained, the target object is rendered based on a multi-target rendering function, and the rendering result is stored in a frame buffer object.

[0097] Among them, the multi-target rendering function is a technology that allows the rendering results to be written into multiple different target buffers at the same time during the graphics rendering process.

[0098] Specifically, based on the multi-target rendering function, different attribute information of the target object is rendered into different rendering buffer objects and mounted on the frame buffer object.

[0099] Among them, the different attribute information of the target object includes the identification of the target object.

[0100] Of course, it also includes information such as the RGBA value of each grid pixel of the target object.

[0101] Send the rendering mesh data corresponding to the target object to the rendering pipeline, and turn on the multi-target rendering function. In one rendering command, different attribute information of the target object is rendered into different rendering buffer objects through the rendering pipeline. Among them, the rendering buffer object is the buffer.

[0102] Write the target object's identifier into the render buffer object, which is different from the render buffer objects of the color buffer and template buffer.

[0103] When writing the target object's identifier into the rendering buffer object, i.e., the buffer, the target object's identifier can be converted into the RGBA value of each pixel stored in the buffer based on a preset conversion algorithm, and the target object's identifier corresponds to the RGBA value of each pixel one by one.

[0104] The identification length of the target object can be designed based on actual needs. For example, the maximum length of the target object can be designed to be 32 bits, corresponding to r, g, b, and a in the buffer respectively. The data length of r, g, b, and a is 8 bits.

[0105] After rendering the target object and obtaining the rendering result, the rendering buffer object mounted by the frame buffer object is read to obtain the rendering graphics and display them. The rendering graphics include the rendered target object and the identifier of the target object.

[0106] Exemplarily, the pixel data reading interface (API, application programming interface) of the readpixels class in the basic graphics library can be used to read all pixel values ​​in the buffer storing the identification of the target object, and these pixel values ​​represent the identification of the target object.

[0107] That is, the identifier of the target object is rendered into the rendering buffer object, that is, the identifier of the target object is written into the shader program.

[0108] In this embodiment, the identification of the target object and other attributes of the target object are rendered to different rendering buffer objects and mounted on the frame buffer object. After that, the rendering buffer object mounted on the frame buffer object is read to obtain and display the rendered graphics, including the rendered target object and the identification of the target object. In this way, the identification of the rendering target, i.e., the identification of the rendering result after the target object is rendered, can be recorded. Based on the identification, the rendering target, i.e., the rendered target object, can be quickly picked up, thereby improving the rendering efficiency.

[0109] In order to achieve accurate recording of the frame selection results and ensure accurate identification of the target object, in some embodiments, the target object is rendered. After obtaining the rendering result, the identification of the target object at each position is read, and based on the frame selection range, it is determined again whether the target object exists in the frame selection range, and based on whether the target object exists in the frame selection range, the frame selection result is recorded.

[0110] The selection result is the information of the target object located within the selection range, including the identification of the target object. Based on actual needs, it may also include information such as the type and shape of the target object. The type of the target object may be a person, a vehicle, a road, a green belt, etc.

[0111] For the identification of each target object, based on the coordinates of the selection range and the coordinates of the position where the target object's identification is located, determine whether the target object is within the selection range. After traversing the identification of all targets, record the identification of all targets within the selection range, and discard the identification of targets outside the selection range, thereby realizing the recording of the selection results.

[0112] Exemplarily, the coordinates of the above-mentioned frame selection range and the coordinates of the position where the mark of the target object is located can be NDC coordinates.

[0113] In this way, after rendering the target object and obtaining the rendering result, the target objects that are not within the selection range can be further eliminated, and only the identification of the target objects within the selection range is recorded, so as to achieve accurate recording of the selection result and ensure accurate picking of the target object.

[0114] For example, the object rendering process can be as follows: Figure 5As shown, after starting the detection, the viewing frustum (i.e., the target area to be rendered) is first determined, and then, filtering is performed based on the target octree, and the nodes of the target octree are judged to intersect, that is, whether (each) node of the target octree is partially or completely located in the viewing frustum. If not, the node of the target octree is not located in the viewing frustum, that is, the target octree node does not exist; if so, the target octree node is determined, and the nodes of the target hierarchical bounding box tree are filtered to determine whether the nodes of the target hierarchical bounding box tree indexed by the target octree node space intersect with the viewing frustum, that is, whether the nodes of the target hierarchical bounding box tree indexed by the target octree node space are partially or completely located in the viewing frustum. If so, that is, there is a target hierarchical bounding box tree node, then the rendering is started through the rendering pipeline, and the target object identifier is rendered to the buffer to obtain a buffer storing the target object identifier; if not, it is determined that the node of the target hierarchical bounding box tree is not located in the viewing frustum, that is, the target hierarchical bounding box tree node does not exist.

[0115] Enable the selection detection, obtain the selection range, and convert the coordinates of the selection range to NDC coordinates. After obtaining the buffer storing the target object's identifier, read the target object's identifier in the buffer, and determine whether the read target object identifier is within the selection range. Record the selection result, that is, record the identifier of the target object within the selection range. Correspondingly, discard the identifier of the target object that is not within the selection range.

[0116] Exemplary Devices

[0117] like Figure 6 As shown, the embodiment of the present application further provides a target object rendering device, including an acquisition module 601, an index module 602, a determination module 603 and a rendering module 604.

[0118] in,

[0119] An acquisition module 601 is used to acquire a target area to be rendered in a scene;

[0120] An indexing module 602 is used to perform spatial indexing on nodes of a target hierarchical bounding box tree based on a target octree node to obtain a target hierarchical bounding box tree node, wherein the target octree node is a node of a target octree that is partially or entirely located in the target area to be rendered, and the target octree is obtained by dividing the scene based on an octree structure, and the target hierarchical bounding box tree node is a node of a target hierarchical bounding box tree that is partially or entirely located in the target octree node, and the target hierarchical bounding box tree is obtained by dividing the scene based on a hierarchical bounding box tree structure;

[0121] A determination module 603 is used to determine an object in the target hierarchical bounding box tree node that is located within the target to-be-rendered area as a target object;

[0122] The rendering module 604 is used to render the target object to obtain a rendering result.

[0123] The target object rendering device provided in this embodiment belongs to the same application concept as the target object rendering method provided in the above embodiments of this application, and can execute the method provided in any of the above embodiments of this application, and has the corresponding functional modules and beneficial effects of the execution method. For technical details not fully described in this embodiment, please refer to the specific processing content of the target object rendering method provided in the above embodiments of this application, and will not be repeated here.

[0124] The functions implemented by the above acquisition module 601, index module 602, determination module 603 and rendering module 604 can be implemented in the form of software called by the same or different processors, and the embodiments of the present application are not limited thereto.

[0125] Exemplary Electronic Devices

[0126] Another embodiment of the present application also provides an electronic device, see Figure 7 As shown, the electronic device includes: a memory 700 and a processor 710 .

[0127] The memory 700 is connected to the processor 710 and is used to store programs;

[0128] The processor 710 is used to implement the target object rendering method disclosed in any of the above embodiments by running the program stored in the memory 700.

[0129] Specifically, the electronic device may further include: a bus, a communication interface 720 , an input device 730 and an output device 740 .

[0130] The processor 710, the memory 700, the communication interface 720, the input device 730 and the output device 740 are connected to each other via a bus.

[0131] A bus may include a pathway that transfers information between components of a computer system.

[0132] The processor 710 may be a general-purpose processor, such as a general-purpose central processing unit (CPU), a microprocessor, etc., or an application-specific integrated circuit (ASIC), or one or more integrated circuits for controlling the execution of the program of the present application. It may also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field programmable gate array (FPGA) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0133] The processor 710 may include a main processor, and may also include a baseband chip, a modem, and the like.

[0134] The memory 700 stores a program for executing the technical solution of the present application, and may also store an operating system and other key services. Specifically, the program may include a program code, and the program code includes a computer operation instruction. More specifically, the memory 700 may include a read-only memory (ROM), other types of static storage devices that can store static information and instructions, a random access memory (RAM), other types of dynamic storage devices that can store information and instructions, a disk storage, a flash, and the like.

[0135] The input device 730 may include a device for receiving data and information input by a user, such as a keyboard, a mouse, a camera, a scanner, a light pen, a voice input device, a touch screen, a pedometer, or a gravity sensor.

[0136] Output device 740 may include devices that allow information to be output to a user, such as a display screen, printer, speaker, etc.

[0137] The communication interface 720 may include any transceiver or the like to communicate with other devices or communication networks, such as Ethernet, Radio Access Network (RAN), Wireless Local Area Network (WLAN), etc.

[0138] The processor 710 executes the program stored in the memory 700 and calls other devices, which can be used to implement each step of any target object rendering method provided in the above embodiments of the present application.

[0139] Those skilled in the art will understand that Figure 7 The structure shown in the figure is merely a block diagram of a partial structure related to the scheme of the present application, and does not constitute a limitation on the electronic device to which the scheme of the present application is applied. The specific electronic device may include more or fewer components than shown in the figure, or combine certain components, or have a different arrangement of components.

[0140] An embodiment of the present application also proposes a chip, which includes a processor and a data interface. The processor reads and runs a program stored in a memory through the data interface to execute the target object rendering method introduced in any of the above embodiments. The specific processing process and its beneficial effects can be found in the above-mentioned embodiment introduction of the target object rendering method.

[0141] In addition to the above-mentioned methods and devices, an embodiment of the present application proposes a computer program product, which includes computer program instructions, which, when executed by a processor, enable the processor to execute the steps of the target object rendering method according to various embodiments of the present application described in the above-mentioned "Exemplary Method" section of this specification.

[0142] The computer program product may be written in any combination of one or more programming languages ​​to write program codes for performing the operations of the embodiments of the present application, including object-oriented programming languages, such as Java, C++, etc., and conventional procedural programming languages, such as "C" language or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as an independent software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server.

[0143] In addition, an embodiment of the present application further proposes a storage medium on which a computer program is stored, and the computer program is executed by a processor to execute the steps of the target object rendering method according to various embodiments of the present application described in the above "Exemplary Method" section of this specification.

[0144] The basic principle of the present invention is described above in conjunction with specific embodiments. However, it should be pointed out that the advantages, strengths, effects, etc. mentioned in the present invention are only examples and not limitations, and it cannot be considered that these advantages, strengths, effects, etc. must be possessed by each embodiment of the present invention. In addition, the specific details disclosed above are only for the purpose of illustration and facilitation of understanding, rather than limitation, and the above details do not limit the present invention to being implemented by adopting the above specific details.

[0145] The block diagrams of the devices, apparatuses, equipment, and systems involved in the present invention are only illustrative examples and are not intended to require or imply that they must be connected, arranged, and configured in the manner shown in the block diagrams. As will be appreciated by those skilled in the art, these devices, apparatuses, equipment, and systems can be connected, arranged, and configured in any manner. Words such as "including", "comprising", "having", etc. are open words, referring to "including but not limited to", and can be used interchangeably with them. The words "or" and "and" used here refer to the words "and / or" and can be used interchangeably with them, unless the context clearly indicates otherwise. The word "such as" used here refers to the phrase "such as but not limited to", and can be used interchangeably with it.

[0146] It should also be noted that in the device, apparatus and method of the present invention, each component or each step can be decomposed and / or reassembled, and such decomposition and / or reassembly should be regarded as an equivalent solution of the present invention.

[0147] The above description of the disclosed aspects is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these aspects will be readily apparent to those skilled in the art, and the general principles defined herein may be applied to other aspects without departing from the scope of the present invention. Therefore, the present invention is not intended to be limited to the aspects shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.

[0148] It should be understood that the qualifiers "first", "second", "third", "fourth", "fifth" and "sixth" used in the description of the embodiments of the present invention are only used to more clearly explain the technical solutions and cannot be used to limit the scope of protection of the present invention.

[0149] The above description has been given for the purpose of illustration and description. In addition, this description is not intended to limit the embodiments of the present invention to the forms disclosed herein. Although a number of example aspects and embodiments have been discussed above, those skilled in the art will recognize certain variations, modifications, changes, additions and sub-combinations thereof.

Claims

1. A method for rendering a target object, characterized in that: The method comprises: Get the target area to be rendered in the scene; Based on the target octree node, spatially indexing the nodes of the target hierarchical bounding box tree to obtain a target hierarchical bounding box tree node, wherein the target octree node is a node of the target octree that is partially or entirely located in the target area to be rendered, and the target octree is obtained by dividing the scene based on the octree structure, and the target hierarchical bounding box tree node is a node of the target hierarchical bounding box tree that is partially or entirely located in the target octree node, and the target hierarchical bounding box tree is obtained by dividing the scene based on the hierarchical bounding box tree structure; Determine the object located in the target to-be-rendered area in the target hierarchical bounding box tree node as the target object; The target object is rendered to obtain a rendering result.

2. The object rendering method according to claim 1, characterized in that: The method of spatially indexing the nodes of the target hierarchical bounding box tree based on the target octree node to obtain the target hierarchical bounding box tree node includes: Based on the target octree node, spatially index the non-leaf nodes of the target hierarchical bounding box tree, determine all the non-leaf nodes of the target hierarchical bounding box tree located in the target octree node as first-level bounding box tree nodes, and / or determine some of the non-leaf nodes of the target hierarchical bounding box tree located in the target octree node as second-level bounding box tree nodes; The first-level bounding box tree node is determined as the target-level bounding box tree node; and / or the target-level bounding box tree node is determined based on the lower-level node information of the second-level bounding box tree node.

3. The object rendering method according to claim 2, characterized in that: The determining the target hierarchical bounding box tree node based on the lower-level node information of the second hierarchical bounding box tree node comprises: Based on the target octree node, spatially index the lower-level nodes, determine all of the lower-level nodes located in the target octree node as new first-level bounding box tree nodes, and / or determine part of the lower-level nodes located in the target octree node as new second-level bounding box tree nodes; The new first-level bounding box tree node is determined as the target level bounding box tree node, and / or the target level bounding box tree node is determined based on the lower level node information of the new second-level bounding box tree node, until the new second-level bounding box tree node has no lower level nodes, or the lower level nodes of the new second-level bounding box tree node are all located at the target octree node.

4. The object rendering method according to claim 3, characterized in that: Before spatially indexing the nodes of the target hierarchical bounding box tree based on the target octree node to obtain the target hierarchical bounding box tree node, the method further includes: Based on whether the spatial range of the nodes of the target octree coincides with the spatial range of the nodes of the target hierarchical bounding box tree, a spatial index relationship between the nodes of the target octree and the nodes of the target hierarchical bounding box tree is established.

5. The object rendering method according to any one of claims 1 to 4, characterized in that: The rendering of the target object to obtain a rendering result includes: Based on the multi-target rendering function, different attribute information of the target object is rendered to different rendering buffer objects and mounted on the frame buffer object, and the attribute information includes the identifier of the target object.

6. The object rendering method according to claim 5, characterized in that: After rendering the target object and obtaining a rendering result, the method further includes: The rendering buffer object mounted by the frame buffer object is read to obtain and display a rendering graphic, wherein the rendering graphic includes the rendered target object and an identifier of the target object.

7. A target object rendering device, characterized in that: The device comprises: An acquisition module is used to acquire the target area to be rendered in the scene; An indexing module is used to spatially index the nodes of the target hierarchical bounding box tree based on the target octree node to obtain the target hierarchical bounding box tree node, wherein the target octree node is a node of the target octree that is partially or completely located in the target area to be rendered, and the target octree is obtained by dividing the scene based on the octree structure, and the target hierarchical bounding box tree node is a node of the target hierarchical bounding box tree that is partially or completely located in the target octree node, and the target hierarchical bounding box tree is obtained by dividing the scene based on the hierarchical bounding box tree structure; A determination module, used for determining an object in the target hierarchical bounding box tree node located within the target to-be-rendered area as a target object; The rendering module is used to render the target object to obtain a rendering result.

8. An electronic device, characterized in that: including memory and processor; The memory is connected to the processor and is used to store programs; The processor is used to implement the target object rendering method according to any one of claims 1 to 6 by running the program in the memory.

9. A storage medium, characterized in that: The storage medium stores a computer program, and when the computer program is executed by the processor, the target object rendering method according to any one of claims 1 to 6 is implemented.

10. A computer program product, characterized in that The method comprises computer program instructions, which, when executed by a processor, enable the processor to implement the object rendering method as described in any one of claims 1 to 6.