CN110580734A - Three-dimensional scene rendering method, device and equipment and readable storage medium - Google Patents

Three-dimensional scene rendering method, device and equipment and readable storage medium Download PDF

Info

Publication number
CN110580734A
CN110580734A CN201910865723.0A CN201910865723A CN110580734A CN 110580734 A CN110580734 A CN 110580734A CN 201910865723 A CN201910865723 A CN 201910865723A CN 110580734 A CN110580734 A CN 110580734A
Authority
CN
China
Prior art keywords
node
state attribute
attribute
tree
state
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201910865723.0A
Other languages
Chinese (zh)
Other versions
CN110580734B (en
Inventor
俞蔚
李斌
刘凤芹
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Zhejiang Kelan Information Technology Co Ltd
Original Assignee
Zhejiang Kelan Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Zhejiang Kelan Information Technology Co Ltd filed Critical Zhejiang Kelan Information Technology Co Ltd
Priority to CN201910865723.0A priority Critical patent/CN110580734B/en
Publication of CN110580734A publication Critical patent/CN110580734A/en
Application granted granted Critical
Publication of CN110580734B publication Critical patent/CN110580734B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06TIMAGE DATA PROCESSING OR GENERATION, IN GENERAL
    • G06T15/003D [Three Dimensional] image rendering
    • G06T15/10Geometric effects
    • G06T15/20Perspective computation
    • G06T15/205Image-based rendering
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • Computing Systems (AREA)
  • Geometry (AREA)
  • Computer Graphics (AREA)
  • General Physics & Mathematics (AREA)
  • Image Generation (AREA)

Abstract

the invention discloses a three-dimensional scene rendering method, a three-dimensional scene rendering device, three-dimensional scene rendering equipment and a readable storage medium, wherein the method comprises the following steps: acquiring a graph structure corresponding to a three-dimensional scene; creating a root node of a state attribute tree, creating state attribute nodes corresponding to a state attribute set in a graph structure, and sequentially inserting the state attribute nodes into the state attribute tree; rendering the three-dimensional scene based on the state attribute tree; sequentially inserting state attribute nodes into a state attribute tree, comprising: determining any state attribute node as a target node; judging whether a corresponding state attribute node exists in the state attribute tree or not, if so, determining that the state attribute node is a target father node, and if not, determining that a root node of the state attribute tree is a target node; and if the target node does not exist under the target father node, inserting the target node under the target father node. Thereby improving rendering efficiency.

Description

Three-dimensional scene rendering method, device and equipment and readable storage medium
Technical Field
the present invention relates to the field of three-dimensional scene rendering technologies, and in particular, to a three-dimensional scene rendering method, apparatus, device, and readable storage medium.
background
the three-dimensional scene is used to simulate the real world, for example, a three-dimensional scene obtained by organizing a plurality of objects in a space of the real world according to spatial attributes (size, position, shape, etc.) of the objects is used to simulate the space. In the prior art, objects included in a three-dimensional scene are often organized by a graph structure, the graph structure includes graph nodes, and the graph nodes include grouping nodes, scheduling nodes, drawing nodes, and the like, in order to achieve a rich and gorgeous drawing effect, one or more different state attributes are usually set on the graph nodes, and the same state attribute may also be set on different graph nodes, and the graph structure in a specific scene may be as shown in fig. 1. In the graph structure, the same state attribute may exist in the same level to occupy a plurality of graph nodes, and Material _0 in fig. 1 occupies two graph nodes in the second level, in which case, more logic resources are wasted when the three-dimensional scene rendering is implemented based on the graph structure, and the rendering efficiency of the three-dimensional scene is low.
in summary, the problem of low rendering efficiency exists in the prior art of realizing rendering of a three-dimensional scene based on a graph structure.
Disclosure of Invention
The invention aims to provide a three-dimensional scene rendering method, a three-dimensional scene rendering device, three-dimensional scene rendering equipment and a readable storage medium, which can solve the problem of low rendering efficiency in the prior art of realizing the rendering of a three-dimensional scene based on a graph structure.
In order to achieve the above purpose, the invention provides the following technical scheme:
a method of three-dimensional scene rendering, comprising:
acquiring a graph structure which is provided with state attributes and corresponding attribute values and corresponds to a three-dimensional scene, wherein the state attributes and the corresponding attribute values of the same graph node in the graph structure are contained in a state attribute set of the graph node;
creating a root node of a state attribute tree, traversing the graph structure, acquiring all state attribute sets in the graph structure, creating state attribute nodes corresponding to each state attribute set, and sequentially inserting the state attribute nodes into the state attribute tree; rendering of the corresponding three-dimensional scene is realized based on the state attribute tree;
wherein sequentially inserting the state attribute nodes into the state attribute tree comprises:
Determining any state attribute node as a target node;
judging whether a state attribute node corresponding to the target node and a parent node of the graph node in the graph structure exists in the state attribute tree or not, if so, determining that the state attribute node is the target parent node, and if not, determining that a root node of the state attribute tree is the target node;
and if the target node does not exist under the target father node, inserting the target node under the target father node.
preferably, the rendering of the corresponding three-dimensional scene based on the state attribute tree is realized, including:
acquiring the inheritance type of each tree node in the state attribute tree, determining the attribute value to be followed by the state attribute in each state attribute set based on the inheritance type, and realizing the rendering of the corresponding three-dimensional scene based on the attribute value to be followed by each state attribute.
Preferably, the obtaining an inheritance type of each tree node in the state attribute tree includes:
Acquiring an inheritance type of each tree node in the state attribute tree, wherein the inheritance type comprises a default type, an overlay type, a protection type and an inheritance type; the default type represents the attribute value of the state attribute of the corresponding tree node, the overlay type represents the attribute value of the same type of state attribute contained in the child node, the protection type represents the attribute value of the state attribute of the corresponding tree node, the inheritance type represents the attribute value of the state attribute of the corresponding tree node, and the inheritance type represents the attribute value of the state attribute of the corresponding tree node.
Preferably, after the rendering of the corresponding three-dimensional scene is implemented based on the state attribute tree, the method further includes:
and outputting the rendered three-dimensional scene to a designated terminal for a corresponding worker to obtain.
A three-dimensional scene rendering apparatus comprising:
An acquisition module to: acquiring a graph structure which is provided with state attributes and corresponding attribute values and corresponds to a three-dimensional scene, wherein the state attributes and the corresponding attribute values of the same graph node in the graph structure are contained in a state attribute set of the graph node;
A creation module to: creating a root node of a state attribute tree, traversing the graph structure, acquiring all state attribute sets in the graph structure, creating state attribute nodes corresponding to each state attribute set, and sequentially inserting the state attribute nodes into the state attribute tree;
a rendering module to: rendering of the corresponding three-dimensional scene is realized based on the state attribute tree;
wherein the creation module comprises:
An insertion unit for: determining any state attribute node as a target node; judging whether a state attribute node corresponding to the target node and a parent node of the graph node in the graph structure exists in the state attribute tree or not, if so, determining that the state attribute node is the target parent node, and if not, determining that a root node of the state attribute tree is the target node; and if the target node does not exist under the target father node, inserting the target node under the target father node.
preferably, the rendering module includes:
a rendering unit to: acquiring the inheritance type of each tree node in the state attribute tree, determining the attribute value to be followed by the state attribute in each state attribute set based on the inheritance type, and realizing the rendering of the corresponding three-dimensional scene based on the attribute value to be followed by each state attribute.
preferably, the rendering unit includes:
An acquisition subunit to: acquiring an inheritance type of each tree node in the state attribute tree, wherein the inheritance type comprises a default type, an overlay type, a protection type and an inheritance type; the default type represents the attribute value of the state attribute of the corresponding tree node, the overlay type represents the attribute value of the same type of state attribute contained in the child node, the protection type represents the attribute value of the state attribute of the corresponding tree node, the inheritance type represents the attribute value of the state attribute of the corresponding tree node, and the inheritance type represents the attribute value of the state attribute of the corresponding tree node.
preferably, the method further comprises the following steps:
an output module to: and outputting the rendered three-dimensional scene to a designated terminal for corresponding staff to obtain after the rendering of the corresponding three-dimensional scene is realized based on the state attribute tree.
a three-dimensional scene rendering apparatus comprising:
a memory for storing a computer program;
a processor for implementing the steps of the three-dimensional scene rendering method as described in any one of the above when the computer program is executed.
A readable storage medium having stored thereon a computer program which, when executed by a processor, carries out the steps of the three-dimensional scene rendering method according to any one of the preceding claims.
According to the three-dimensional scene rendering method, the three-dimensional scene rendering device, the three-dimensional scene rendering equipment and the readable storage medium, the graph structure corresponding to the three-dimensional scene is converted into the state attribute tree, and the situation that the same state attribute set occupies two tree nodes cannot occur under the same parent node in the same level in the conversion process, so that the structure based on the three-dimensional scene rendering is simplified, the waste of logic resources is avoided, and the rendering efficiency of the three-dimensional scene is improved.
drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the provided drawings without creative efforts.
FIG. 1 is a diagram illustrating a three-dimensional scene map structure in a specific scene according to the prior art;
fig. 2 is a flowchart of a three-dimensional scene rendering method according to an embodiment of the present invention;
fig. 3 is a schematic diagram of a state attribute tree corresponding to the graph structure shown in fig. 1 in a three-dimensional scene rendering method according to an embodiment of the present invention;
Fig. 4 is an exemplary diagram of a state attribute tree enumerated during explanation of a problem solved by the three-dimensional scene rendering method according to the embodiment of the present invention;
fig. 5 is a schematic structural diagram of a three-dimensional scene rendering apparatus according to an embodiment of the present invention.
Detailed Description
the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
referring to fig. 2, a flowchart of a three-dimensional scene rendering method according to an embodiment of the present invention is shown, where the method includes:
s11: and acquiring a graph structure which is provided with state attributes and corresponding attribute values and corresponds to the three-dimensional scene, wherein the state attributes and the corresponding attribute values of the same graph node in the graph structure are contained in the state attribute set of the graph node.
It should be noted that an execution subject of the three-dimensional scene rendering method provided by the embodiment of the present invention may be a corresponding three-dimensional scene rendering device. Wherein, the state attribute, the three-dimensional scene and the graph structure have the same meaning as the corresponding concept in the prior art; in the embodiment, drawing of an object in a three-dimensional scene is realized based on opengl (the drawing of the object in the three-dimensional scene based on opengl is realized by the same principle as that of a corresponding technical scheme in the prior art), while a state attribute is defined for opengl, and the opengl can be regarded as a machine capable of recording the state of the opengl, and the state of the opengl can be called as a state attribute, for example, an alpha test, a depth test and the like currently used by the opengl are state attributes, and the state attribute actually corresponds to the attributes of the object in the three-dimensional scene, so that the state attribute can be regarded as the state of the opengl which represents the attribute of the object in the three-dimensional scene; according to the drawing requirements when rendering a three-dimensional scene, corresponding state attributes and attribute values are set to one or more graph nodes of a graph structure, the graph structure is relative to a tree structure, for the tree structure, generally, a parent node can have a plurality of child nodes, but a child node only has one parent node, and for the graph structure, the parent node can have a plurality of child nodes, and the child node can also have a plurality of parent nodes. In this embodiment, a corresponding state attribute set is set for a graph node having a state attribute and an attribute value, where the state attribute set includes the state attribute and the attribute value of the corresponding graph node, that is, each graph node having the state attribute and the attribute value has a state attribute set, and each state attribute set includes at least one state attribute and a corresponding attribute value; when the rendering of the three-dimensional scene is realized based on the graph structure, the rendering is realized based on the state attribute set of each graph node in the graph structure, and when the three-dimensional scene is rendered according to the graph structure shown in fig. 1, the rendering is required to be performed according to the state attribute set on each graph node included in a branch corresponding to an object to be rendered in the graph structure; taking fig. 1 as an example, the root node is LIGHT, the leftmost branch is LIGHT, Material _0 and Texture _0, and the last graph node (Texture _0) of the leftmost branch is marked with 1, that is, object 1 needs to be rendered by the leftmost branch, then when rendering corresponding object 1, the state attributes LIGHT of the object are set to (LIGHT, 0), Material _0 is (Material, 0), Texture _0 is (Texture, 0), and so on for other objects.
s12: the method comprises the steps of creating a root node of a state attribute tree, traversing a graph structure, obtaining all state attribute sets in the graph structure, creating state attribute nodes corresponding to each state attribute set, and sequentially inserting the state attribute nodes into the state attribute tree. Wherein, insert the state attribute node in the state attribute tree in proper order, include: determining any state attribute node as a target node; judging whether a state attribute node corresponding to a parent node of the graph node in the graph structure corresponding to the target node exists in the state attribute tree or not, if so, determining that the state attribute node is the target parent node, and if not, determining that a root node of the state attribute tree is the target node; and if the target node does not exist under the target father node, inserting the target node under the target father node.
in this embodiment, a state attribute tree is created, and tree nodes included in the state attribute tree correspond to different state attribute sets, so that rendering of a three-dimensional scene is realized based on the state attribute tree. Specifically, a root node of a state attribute tree needs to be created, a state attribute set corresponding to the root node of the state attribute tree includes all state attributes included in a graph structure, and all state attributes included in a state attribute set corresponding to the root node of the default state attribute tree are invalid (the state attribute is invalid, that is, an attribute value of the state attribute is a value representing an invalid state), so that when the three-dimensional scene rendering is realized based on the opengl state machine, the state attribute corresponding to the root node can be consistent with the states of the state attributes used in the current opengl state machine, the state of the state attribute on the opengl state machine does not need to be modified, the state switching is reduced, and the time cost is saved.
All state attribute sets contained in the graph structure can be obtained by traversing the graph structure, and after all the state attribute sets in the graph structure are obtained, state attribute nodes corresponding to each state attribute set can be created, specifically, each state attribute node represents one state attribute set; when the state attribute nodes are sequentially inserted into the state attribute tree, the state attribute nodes to be inserted into the state attribute tree can be called target nodes, whether state attribute nodes corresponding to parent nodes of the graph nodes in the graph structure corresponding to the target nodes exist in the state attribute tree is judged, if yes, the state attribute nodes corresponding to the parent nodes of the graph nodes in the graph structure corresponding to the target nodes are determined to be parent nodes of the target nodes, namely the target parent nodes, if not, the root nodes of the state attribute tree are directly determined to be parent nodes of the target nodes, namely the target parent nodes, and then after the parent nodes of the target nodes are determined, the insertion of the target nodes into the state attribute tree is realized, specifically: if the target node exists under the target father node, the insertion is determined to be completed, and if the target node does not exist under the target father node, the target node is inserted under the target father node; thereby realizing the conversion from the graph structure to the state attribute tree; the state attribute tree thus obtained only includes state attribute nodes corresponding to the graph nodes having the state attribute set, and the same parent node does not include the same two state attribute nodes. In addition, objects (such as 1 to 6 shown in fig. 1) identified in the graph structure also need to be identified in the state attribute tree, and in particular, any object represented in the graph structure can be determined as a target object, a state attribute node corresponding to a state attribute set of a graph node marked with the target object in the state attribute tree is determined, and marking the target object under the determined state attribute node corresponding to the state attribute set of the graph node marked with the target object (fig. 3 is a state attribute tree corresponding to fig. 2, wherein 1 to 6 are marked objects), to be able to determine the object to be rendered for each branch when rendering is performed based on the state property tree, and, in particular, if there is a case where two or more branches correspond to one object (e.g., object 6 in fig. 3 corresponds to two branches), the corresponding object is sequentially rendered according to each branch.
s13: and rendering the corresponding three-dimensional scene based on the state attribute tree.
the principle of rendering the corresponding three-dimensional scene based on the state attribute tree is the same as that of rendering the corresponding three-dimensional scene based on the graph structure, and is not described herein again.
in the technical scheme disclosed by the application, the graph structure corresponding to the three-dimensional scene is converted into the state attribute tree, and in the conversion process, the condition that the same state attribute set occupies two tree nodes cannot occur under the same parent node at the same level, so that the structure based on the three-dimensional scene rendering is simplified, the waste of logic resources is avoided, and the rendering efficiency of the three-dimensional scene is improved.
it should be noted that, the process of inserting the state attribute node corresponding to each state attribute set in the graph structure into the state attribute tree may be implemented based on a stack, that is, each time, the state attribute set to be inserted is pushed onto the stack, and the state attribute node is popped out after the insertion of the corresponding state attribute node is completed; specifically, taking the graph structure of fig. 1 as an example, the above-mentioned step S12 to step S13 (a process of obtaining a state attribute tree based on the graph structure) are described, where the correspondingly obtained state attribute tree is as shown in fig. 3 (it should be noted that, since the graph structure in practical application includes much more graph nodes than the graph structure illustrated in fig. 1, the graph structure is converted into the corresponding state attribute tree by using the technical solution of the present application, and merging of corresponding tree nodes of the same state attribute set can be achieved, that is, the same state attribute set does not occupy two tree nodes under the same parent node of the same level, and therefore, the state attribute tree in practical application is more simplified relative to the corresponding graph structure, that is, the structure based on when three-dimensional scene rendering is simplified), and specifically, the method may include:
a root node0 of the state attribute tree is created, the state attribute set of the root node0 contains all state attributes contained in the graph structure, and the state attributes in the state attribute set of the root node0 are all invalid states;
Cutting from the root node of the graph structure, if the root node of the graph structure contains a state attribute set, pressing the state attribute set of the root node into a stack, pushing Light, searching whether a state attribute node corresponding to the pushed Light exists on the root node0, if not, creating a state attribute node1 of the Light, inserting the state attribute node1 into a child node of the root node0 (or under the root node 0), popping the Light, and cutting a next object;
material _0 is pushed, a state attribute node2 is created and is inserted into a child node of the node1, and the next object is cut;
the Texture _0 is pushed, a state attribute node3 is created and is inserted into a child node of the node2, the object 1 is marked, the Texture _0 is pushed, and the next object is cut;
Light _0 pushes, creates state attribute node4, inserts into node2 child node, cuts the next object;
PointSize _1 is pushed, a state attribute node5 is created, the node is inserted into a child node of the node4, and the next object is cut;
the method comprises the steps of pushing Texennv _0, creating a state attribute node6, inserting the state attribute node6 into a child node of a node5, marking an object 2, pushing Texennv _0 out, and cutting the next object;
the FrontFace _0 is pushed, a state attribute node7 is created, the node is inserted into a child node of the node5, and the next object is cut;
push Blend _1, create state attribute node8, insert on node7 child node, mark object 3;
Popping Blend _ 1;
The FrontFace _0 is popped;
Popping PointSize _ 1;
Light _0 popping;
Material _0 is popped, and the next object is cut;
The method _1 is pushed, a state attribute node9 is created, the node is inserted into a child node of the node1, and the next object is cut;
PointSize _1 is pushed, a state attribute node10 is created, the node is inserted into a child node of the node9, and the next object is cut;
light _0 pushes, creates state attribute node11, inserts into node10 child node, cuts the next object;
the Texture _1 is pushed, a state attribute node12 is created and is inserted into a child node of the node11, and the object 4 is marked;
popping Texture _ 1;
the Light _0 is popped, and the next object is cut;
push Blend _0, create state attribute node13, insert it into node10 child node, cut the next object;
The Texture _1 is pushed, a state attribute node14 is created and is inserted into a child node of the node13, and the object 5 is marked;
Popping Texture _ 1;
The Blend _0 is popped;
popping PointSize _ 1;
Material _1 is popped, and the next object is cut;
material _2 is pushed, a state attribute node15 is created and is inserted into a child node of the node1, and the next object is cut;
stacking the CullFace _1, creating a state attribute node16, inserting the node into a child node of the node15, and cutting a next object;
the Texgen _1 is pushed, a state attribute node17 is created and is inserted into a child node of the node16 to mark the object 6;
texgen _ pop;
Popping the CullFace _ 1;
Material _2 is popped, and the next object is cut;
material _0 is pushed, the state attribute set is searched from the child node of the node1, the searching is successful, and the next object is cut by directly using the child node 2;
the Texgen _1 is pushed, a state attribute node18 is created and is inserted into a child node of the node2 to mark the object 6;
the Texgen _1 is popped;
Material _0 is popped;
and Light is popped.
It should be noted that, before creating a state attribute node each time in the above steps, or before inserting a state attribute node into a state attribute tree, it is necessary to search whether a state attribute node to be inserted exists under a parent node from a corresponding parent node, if so, the existing state attribute node is directly used, otherwise, the existing state attribute node is inserted under the corresponding parent node, and in the above steps, the above determination steps are not described for simplifying the description; in addition, the state attribute node corresponding to the state attribute set may be created at any time before the insertion is implemented, and is not particularly limited.
the three-dimensional scene rendering method provided by the embodiment of the invention is used for realizing the rendering of a corresponding three-dimensional scene based on a state attribute tree, and can comprise the following steps:
acquiring the inheritance type of each tree node in the state attribute tree, determining the attribute value to be followed by the state attribute in each state attribute set based on the inheritance type, and realizing the rendering of the corresponding three-dimensional scene based on the attribute value to be followed by each state attribute.
since Opengl is a software interface for graphics hardware, it works in the manner of a state machine, putting it into various states (or modes) and then keeping it active until after changing their state attributes, it keeps the modified state active. Therefore, regardless of repeatedly setting a certain state attribute a plurality of times before drawing an object, it still makes only the last set state valid, and the last set state attribute parameter is used in drawing. Assuming that the color state is taken as an example, the color is set to red, then to green, and finally to blue before drawing, the drawing object will appear to be blue. Specifically, when an object is drawn according to the state attribute tree, drawing is required to be performed according to the state attribute on each tree node included in a branch corresponding to the object to be drawn in the state attribute tree; taking fig. 3 as an example, if the parent node is LIGHT, and the second branch from the left is LIGHT, Material _0, and Texture _1, then when drawing the corresponding object (object 1), the state attribute LIGHT of the object is (LIGHT, 0), Material _0 is (materal, 0), and Texture _1 is (Texture, 0) are set in sequence; if the third node in the branch is LIGHT, and the value of the status attribute is (LIGHT, 1), the status attribute of the object is sequentially set to LIGHT (LIGHT, 0), Material _1 (matrix, 0), and LIGHT (LIGHT, 1), and when the object is drawn based on Opengl, the drawing object is made to present the value of the last set status attribute, so that a process of switching the status attribute of LIGHT from (LIGHT, 0) to (LIGHT, 1) occurs, and the switching overhead is very large, which seriously affects the drawing efficiency of the three-dimensional scene, and a card frame and a frame drop phenomenon occur for setting the three-dimensional scene of the large scene, so that the display result is not smooth.
It should be noted that, a corresponding inheritance type can be set for each tree node in the state attribute tree according to actual needs, so that based on the inheritance type, it can be known which attribute value needs to be followed when any state attribute has different attribute values, and thus, a final drawing object has an effective state attribute for each state attribute, thereby not only making the setting of the state attribute more flexible, but also avoiding the huge switching overhead caused by the repeated setting of the state attribute when any state attribute has different attribute values, and also avoiding the problems of reducing rendering efficiency, frame blocking and frame dropping caused by the repeated setting.
specifically, obtaining the inheritance type of each tree node in the state attribute tree may include:
Acquiring inheritance types of each tree node in the state attribute tree, wherein the inheritance types comprise a default type, an overlay type, a protection type and an inheritance type; the default type represents the attribute value of the state attribute of the corresponding tree node, the covering type represents the attribute value of the same type of state attribute contained in the child node, the protecting type represents the attribute value of the state attribute of the corresponding tree node, the inheriting type represents the attribute value of the state attribute of the corresponding tree node, and the inheriting type represents the attribute value of the state attribute of the corresponding tree node.
it should be noted that the setting of the inheritance type can be set according to actual needs, and in this embodiment, four inheritance types can be set, which are respectively GENERAL (default type), overlay (overlay type), PROTECTED (PROTECTED type), and INHERIT (inheritance type); the inheritance type of a state attribute can be considered to be GENERAL by default. Specifically, any tree node is referred to as a target tree node, if the inheritance type of the target tree node is GENERAL, the attribute value of the state attribute corresponding to the target tree node is used by default, but at this time, if the inheritance type of the parent node of the target tree node is overtride, the attribute value of the state attribute of the target tree node follows the attribute value of the state attribute of the same type contained in the parent node of the target tree node, that is, the meaning of GENERAL is that if the inheritance types of other tree nodes do not influence the inheritance types of other tree nodes, the attribute value of the state attribute which the tree node with the inheritance type of GENERAL has is used by default, and if the inheritance types of other tree nodes influence the inheritance types of other tree nodes, the attribute value of the state attribute which the tree node with the inheritance type of GENERAL has is changed by the influence of other tree nodes; if the inheritance type of the target tree node is OVERRIDE, the attribute value of the state attribute of the target tree node covers the attribute values of the state attributes of the same type contained in all the child nodes of the target tree node, namely, the attribute values of the state attributes of the same type of the target tree node need to be followed no matter what the attribute values of the state attributes of the same type contained in the child nodes of the target tree node are; if the inheritance type of the target tree node is PROTECTED, the inheritance type is not influenced by the attribute value of the state attribute of the same type of the parent node no matter how the attribute value of the state attribute of the parent node of the target tree node is; if the inheritance type of the target tree node is INHERIT, the state attribute of the target tree node enforces the attribute value of the same type of state attribute that the parent node of the target tree node has, and the attribute values of the same state attribute contained in the child nodes of the target tree node are all considered invalid. Therefore, the attribute value of the state attribute can be determined through the simple principles, and the method is convenient and quick.
After the rendering of the corresponding three-dimensional scene is realized based on the state attribute tree, the method for rendering the three-dimensional scene provided by the embodiment of the invention may further include:
and outputting the rendered three-dimensional scene to a designated terminal for a corresponding worker to obtain.
It should be noted that, in order to facilitate the acquisition of the three-dimensional scene by the staff, in this embodiment, a designated terminal corresponding to the staff may be preset, and then the rendered three-dimensional scene is directly sent to the designated terminal, so that the staff may remotely acquire the three-dimensional scene.
taking fig. 4 as an example to illustrate the effective effect of the technical scheme disclosed by the present invention, taking the node5 as an example, both the node1 and the node2 are set with state attributes, if there is no state attribute inheritance relationship (inheritance type), the state attribute corresponding to the node1 needs to be set on the opengl state machine first, then the state attribute corresponding to the node2 is set, and then the node5 is drawn, so that the same state attribute is frequently switched, and time is consumed; in another case, as shown in fig. 4, the state attribute s1 is set for each of the node2, the node3, and the node4, the state attribute s1 is invalid for the node2, the state attribute is invalid for the node3, and the state attribute is invalid for the node4, so that when the nodes 5, 6, 7, and 8 are drawn, the state attribute s1 is invalid for drawing the node5 and the node, then the state attribute s1 is set to be valid for drawing the node6, the node7, and the node8, and then the state attribute s1 is invalid for drawing the node8, and the nodes are drawn and need to be switched twice, which consumes time. Moreover, the principle of realizing node drawing by using the graph structure in the prior art is the same as that of realizing node drawing by using the state attribute tree. Therefore, the proper state attribute tree is constructed, so that the frequent switching of the state attributes is reduced, the switching cost is reduced, and the scene drawing efficiency is improved; meanwhile, the repeated submission of the same type of state attribute instructions to the GPU can be reduced, the time consumption of the GPU is saved, and the resource waste is avoided.
An embodiment of the present invention further provides a three-dimensional scene rendering apparatus, as shown in fig. 5, the apparatus may include:
An obtaining module 11, configured to: acquiring a graph structure which is provided with state attributes and corresponding attribute values and corresponds to a three-dimensional scene, wherein the state attributes and the corresponding attribute values of the same graph node in the graph structure are contained in a state attribute set of the graph node;
a creation module 12 for: creating a root node of a state attribute tree, traversing a graph structure, acquiring all state attribute sets in the graph structure, creating state attribute nodes corresponding to each state attribute set, and sequentially inserting the state attribute nodes into the state attribute tree;
a rendering module 13 for: rendering of the corresponding three-dimensional scene is realized based on the state attribute tree;
wherein, the creating module 11 comprises:
An insertion unit 111 for: determining any state attribute node as a target node; judging whether a state attribute node corresponding to a parent node of the graph node in the graph structure corresponding to the target node exists in the state attribute tree or not, if so, determining that the state attribute node is the target parent node, and if not, determining that a root node of the state attribute tree is the target node; and if the target node does not exist under the target father node, inserting the target node under the target father node.
In an embodiment of the present invention, a rendering module of a three-dimensional scene rendering apparatus may include:
A rendering unit to: acquiring the inheritance type of each tree node in the state attribute tree, determining the attribute value to be followed by the state attribute in each state attribute set based on the inheritance type, and realizing the rendering of the corresponding three-dimensional scene based on the attribute value to be followed by each state attribute.
in an embodiment of the present invention, a rendering unit of a three-dimensional scene rendering apparatus may include:
An acquisition subunit to: acquiring inheritance types of each tree node in the state attribute tree, wherein the inheritance types comprise a default type, an overlay type, a protection type and an inheritance type; the default type represents the attribute value of the state attribute of the corresponding tree node, the covering type represents the attribute value of the same type of state attribute contained in the child node, the protecting type represents the attribute value of the state attribute of the corresponding tree node, the inheriting type represents the attribute value of the state attribute of the corresponding tree node, and the inheriting type represents the attribute value of the state attribute of the corresponding tree node.
The three-dimensional scene rendering device provided by the embodiment of the present invention may further include:
an output module to: and after the rendering of the corresponding three-dimensional scene is realized based on the state attribute tree, outputting the rendered three-dimensional scene to a specified terminal for the corresponding staff to obtain.
An embodiment of the present invention further provides a three-dimensional scene rendering device, which may include:
a memory for storing a computer program;
a processor for implementing the steps of the three-dimensional scene rendering method as described above when executing the computer program.
an embodiment of the present invention further provides a readable storage medium, where a computer program is stored on the readable storage medium, and when being executed by a processor, the computer program implements the steps of any one of the above three-dimensional scene rendering methods.
It should be noted that for the description of the relevant parts in the three-dimensional scene rendering device, the apparatus, and the readable storage medium provided in the embodiments of the present invention, reference is made to the detailed description of the corresponding parts in the three-dimensional scene rendering method provided in the embodiments of the present invention, and details are not repeated here. In addition, parts of the technical solutions provided in the embodiments of the present invention that are consistent with the implementation principles of the corresponding technical solutions in the prior art are not described in detail, so as to avoid redundant description.
the previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (10)

1. a method of rendering a three-dimensional scene, comprising:
acquiring a graph structure which is provided with state attributes and corresponding attribute values and corresponds to a three-dimensional scene, wherein the state attributes and the corresponding attribute values of the same graph node in the graph structure are contained in a state attribute set of the graph node;
Creating a root node of a state attribute tree, traversing the graph structure, acquiring all state attribute sets in the graph structure, creating state attribute nodes corresponding to each state attribute set, and sequentially inserting the state attribute nodes into the state attribute tree; rendering of the corresponding three-dimensional scene is realized based on the state attribute tree;
Wherein sequentially inserting the state attribute nodes into the state attribute tree comprises:
Determining any state attribute node as a target node;
judging whether a state attribute node corresponding to the target node and a parent node of the graph node in the graph structure exists in the state attribute tree or not, if so, determining that the state attribute node is the target parent node, and if not, determining that a root node of the state attribute tree is the target node;
And if the target node does not exist under the target father node, inserting the target node under the target father node.
2. The method of claim 1, wherein rendering the corresponding three-dimensional scene based on the state property tree comprises:
Acquiring the inheritance type of each tree node in the state attribute tree, determining the attribute value to be followed by the state attribute in each state attribute set based on the inheritance type, and realizing the rendering of the corresponding three-dimensional scene based on the attribute value to be followed by each state attribute.
3. the method of claim 2, wherein obtaining the inheritance type of each tree node in the state property tree comprises:
acquiring an inheritance type of each tree node in the state attribute tree, wherein the inheritance type comprises a default type, an overlay type, a protection type and an inheritance type; the default type represents the attribute value of the state attribute of the corresponding tree node, the overlay type represents the attribute value of the same type of state attribute contained in the child node, the protection type represents the attribute value of the state attribute of the corresponding tree node, the inheritance type represents the attribute value of the state attribute of the corresponding tree node, and the inheritance type represents the attribute value of the state attribute of the corresponding tree node.
4. the method of claim 3, after the rendering of the corresponding three-dimensional scene based on the state property tree is achieved, further comprising:
And outputting the rendered three-dimensional scene to a designated terminal for a corresponding worker to obtain.
5. a three-dimensional scene rendering apparatus, comprising:
an acquisition module to: acquiring a graph structure which is provided with state attributes and corresponding attribute values and corresponds to a three-dimensional scene, wherein the state attributes and the corresponding attribute values of the same graph node in the graph structure are contained in a state attribute set of the graph node;
A creation module to: creating a root node of a state attribute tree, traversing the graph structure, acquiring all state attribute sets in the graph structure, creating state attribute nodes corresponding to each state attribute set, and sequentially inserting the state attribute nodes into the state attribute tree;
a rendering module to: rendering of the corresponding three-dimensional scene is realized based on the state attribute tree;
Wherein the creation module comprises:
an insertion unit for: determining any state attribute node as a target node; judging whether a state attribute node corresponding to the target node and a parent node of the graph node in the graph structure exists in the state attribute tree or not, if so, determining that the state attribute node is the target parent node, and if not, determining that a root node of the state attribute tree is the target node; and if the target node does not exist under the target father node, inserting the target node under the target father node.
6. the apparatus of claim 5, wherein the rendering module comprises:
a rendering unit to: acquiring the inheritance type of each tree node in the state attribute tree, determining the attribute value to be followed by the state attribute in each state attribute set based on the inheritance type, and realizing the rendering of the corresponding three-dimensional scene based on the attribute value to be followed by each state attribute.
7. The apparatus of claim 6, wherein the rendering unit comprises:
an acquisition subunit to: acquiring an inheritance type of each tree node in the state attribute tree, wherein the inheritance type comprises a default type, an overlay type, a protection type and an inheritance type; the default type represents the attribute value of the state attribute of the corresponding tree node, the overlay type represents the attribute value of the same type of state attribute contained in the child node, the protection type represents the attribute value of the state attribute of the corresponding tree node, the inheritance type represents the attribute value of the state attribute of the corresponding tree node, and the inheritance type represents the attribute value of the state attribute of the corresponding tree node.
8. the apparatus of claim 7, further comprising:
an output module to: and outputting the rendered three-dimensional scene to a designated terminal for corresponding staff to obtain after the rendering of the corresponding three-dimensional scene is realized based on the state attribute tree.
9. a three-dimensional scene rendering apparatus, comprising:
a memory for storing a computer program;
a processor for implementing the steps of the three-dimensional scene rendering method according to any one of claims 1 to 4 when executing the computer program.
10. a readable storage medium, characterized in that the computer readable storage medium has stored thereon a computer program which, when being executed by a processor, carries out the steps of the three-dimensional scene rendering method according to any one of claims 1 to 4.
CN201910865723.0A 2019-09-12 2019-09-12 Three-dimensional scene rendering method, device, equipment and readable storage medium Active CN110580734B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910865723.0A CN110580734B (en) 2019-09-12 2019-09-12 Three-dimensional scene rendering method, device, equipment and readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910865723.0A CN110580734B (en) 2019-09-12 2019-09-12 Three-dimensional scene rendering method, device, equipment and readable storage medium

Publications (2)

Publication Number Publication Date
CN110580734A true CN110580734A (en) 2019-12-17
CN110580734B CN110580734B (en) 2023-04-25

Family

ID=68811695

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910865723.0A Active CN110580734B (en) 2019-09-12 2019-09-12 Three-dimensional scene rendering method, device, equipment and readable storage medium

Country Status (1)

Country Link
CN (1) CN110580734B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111176772A (en) * 2019-12-24 2020-05-19 安克创新科技股份有限公司 Method and device for state switching and robot
CN111273977A (en) * 2020-01-13 2020-06-12 陕西心像信息科技有限公司 Scene automatic updating method and updating equipment of three-dimensional visualization platform
CN115439608A (en) * 2022-09-01 2022-12-06 广州南方智能技术有限公司 Model rendering method and device based on snapshot and multiple routes and storage medium

Citations (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101692230A (en) * 2009-07-28 2010-04-07 武汉大学 Three-dimensional R tree spacial index method considering levels of detail
CN106023297A (en) * 2016-05-20 2016-10-12 江苏得得空间信息科技有限公司 Texture dynamic organization method for fine three-dimensional model
CN106296785A (en) * 2016-08-09 2017-01-04 腾讯科技(深圳)有限公司 A kind of picture rendering intent and picture rendering apparatus
US20170249779A1 (en) * 2016-02-25 2017-08-31 Qualcomm Incorporated Start node determination for tree traversal for shadow rays in graphics processing
US9754405B1 (en) * 2015-08-10 2017-09-05 Ngrain (Canada) Corporation System, method and computer-readable medium for organizing and rendering 3D voxel models in a tree structure
US20170294043A1 (en) * 2016-04-06 2017-10-12 Samsung Electronics Co., Ltd. Method and apparatus for performing path rendering
CN107564087A (en) * 2017-09-11 2018-01-09 南京大学 A kind of Three-D linear symbol rendering intent based on screen
CN107689078A (en) * 2017-08-21 2018-02-13 哈尔滨工程大学 A kind of bounding volume hierarchy (BVH) tree constructing method based on chain list sorting balanced binary tree

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101692230A (en) * 2009-07-28 2010-04-07 武汉大学 Three-dimensional R tree spacial index method considering levels of detail
US9754405B1 (en) * 2015-08-10 2017-09-05 Ngrain (Canada) Corporation System, method and computer-readable medium for organizing and rendering 3D voxel models in a tree structure
US20170249779A1 (en) * 2016-02-25 2017-08-31 Qualcomm Incorporated Start node determination for tree traversal for shadow rays in graphics processing
CN108701366A (en) * 2016-02-25 2018-10-23 高通股份有限公司 The start node of tree traversal for the shadow ray in graphics process determines
US20170294043A1 (en) * 2016-04-06 2017-10-12 Samsung Electronics Co., Ltd. Method and apparatus for performing path rendering
CN106023297A (en) * 2016-05-20 2016-10-12 江苏得得空间信息科技有限公司 Texture dynamic organization method for fine three-dimensional model
CN106296785A (en) * 2016-08-09 2017-01-04 腾讯科技(深圳)有限公司 A kind of picture rendering intent and picture rendering apparatus
CN107689078A (en) * 2017-08-21 2018-02-13 哈尔滨工程大学 A kind of bounding volume hierarchy (BVH) tree constructing method based on chain list sorting balanced binary tree
CN107564087A (en) * 2017-09-11 2018-01-09 南京大学 A kind of Three-D linear symbol rendering intent based on screen

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
张敬斋;张鹏洲;乔向东;: "改进三维偏序分形树建模方法研究" *
聂俊岚;张继凯;刘硕;郭栋梁;: "基于枚举四叉树的多分辨率几何图像绘制方法" *
臧明生;邬正义;谈正;: "3D场景的树结构管理与实现" *

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111176772A (en) * 2019-12-24 2020-05-19 安克创新科技股份有限公司 Method and device for state switching and robot
CN111176772B (en) * 2019-12-24 2022-07-01 安克创新科技股份有限公司 Method and device for state switching and robot
CN111273977A (en) * 2020-01-13 2020-06-12 陕西心像信息科技有限公司 Scene automatic updating method and updating equipment of three-dimensional visualization platform
CN111273977B (en) * 2020-01-13 2023-09-12 陕西心像信息科技有限公司 Automatic scene updating method and device for three-dimensional visualization platform
CN115439608A (en) * 2022-09-01 2022-12-06 广州南方智能技术有限公司 Model rendering method and device based on snapshot and multiple routes and storage medium

Also Published As

Publication number Publication date
CN110580734B (en) 2023-04-25

Similar Documents

Publication Publication Date Title
CN110580734B (en) Three-dimensional scene rendering method, device, equipment and readable storage medium
CN102843298B (en) Realize the method and system of exchanger chip Openflow stream table priority
JP2003044296A5 (en)
CN110559665A (en) Game map processing method and device, terminal device and storage medium
CN107463692B (en) Super large text data is synchronized to the method and system of search engine
CN104751507A (en) Method and device for rendering pattern contents
CN108829510B (en) Thread binding processing method and device
CN105718272A (en) Method for restoring factory settings of terminal and terminal
CN105991478A (en) Server resource distribution method and system
CN111399941A (en) Batch configuration method, device and equipment for BMC (baseboard management controller) functions
CN111258434B (en) Method, device, equipment and storage medium for inserting pictures in chat interface
CN112799598B (en) Data processing method, processor and electronic equipment
CN105898399A (en) Video resource loading method and device and smart television
CN110490798A (en) Point cloud method and system
CN115937396A (en) Image rendering method and device, terminal equipment and computer readable storage medium
CN111583374B (en) Method for making rendering proxy file
CN108376101B (en) Method and device for managing resources in Unity3D runtime
CN110928628B (en) Game element processing method and device, storage medium and processor
CN114470767A (en) Task processing method and device and electronic equipment
CN113961344A (en) Resource processing method and system
CN110427183B (en) Graphical function editing method and device and configuration software
CN111524446B (en) Data processing method and device, electronic equipment and readable storage medium
CN109379284B (en) Route execution method, storage medium, and terminal device
CN112035656A (en) Method, device, computer equipment and medium for quickly previewing document
CN111476872A (en) Image drawing method and image drawing device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant