CN113468286A - Three-dimensional pyramid construction method based on triangular patch number division - Google Patents
Three-dimensional pyramid construction method based on triangular patch number division Download PDFInfo
- Publication number
- CN113468286A CN113468286A CN202111024709.1A CN202111024709A CN113468286A CN 113468286 A CN113468286 A CN 113468286A CN 202111024709 A CN202111024709 A CN 202111024709A CN 113468286 A CN113468286 A CN 113468286A
- Authority
- CN
- China
- Prior art keywords
- triangular
- binary tree
- node
- splitting
- edge
- 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.)
- Pending
Links
Images
Classifications
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06F—ELECTRIC DIGITAL DATA PROCESSING
- G06F16/00—Information retrieval; Database structures therefor; File system structures therefor
- G06F16/20—Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
- G06F16/29—Geographical information databases
-
- G—PHYSICS
- G06—COMPUTING; CALCULATING OR COUNTING
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T17/00—Three dimensional [3D] modelling, e.g. data description of 3D objects
- G06T17/05—Geographic models
Abstract
The invention discloses a three-dimensional pyramid construction method based on triangular patch number division, which comprises the following steps: s1: respectively setting the maximum number of triangular patches of a single nodeFaceCountParameters and maximum number of triangular patches for a single componentmeshFaceCountA parameter; s2: reading data of the three-dimensional model, and analyzing geometric, texture and attribute information of the three-dimensional model; s3: setting the maximum depth of the binary tree, and setting the read three-dimensional model as a root node of the binary tree; s4: determining the coordinate axis direction of node splitting, and splitting the binary tree; s5: traversing the binary tree, and recalculating the outer bounding boxes of each node of the binary tree; combining the components with the same texture in the three-dimensional model, and constructing a component set; s6: traversing nodes of the binary tree, calculating triangular patch simplification parameters of the current nodes, and simplifying the triangular patch; s7: recalculating texture coordinates of the simplified triangular patch; s8: and outputting the model pyramid data.
Description
Technical Field
The invention relates to the technical field of three-dimensional model index creation, in particular to a three-dimensional pyramid construction method based on triangular patch number division.
Background
The three-dimensional GIS becomes one of the main symbolic contents of the GIS technology at present and even in the future, breaks through the constraint that spatial information is monotonously expressed in a two-dimensional map plane, and provides more effective auxiliary decision support for various industries and daily life of people. With the 'digital twin' concept going deep into the mind, the demand for displaying the city-level large-scene three-dimensional model is more and more strong in the application of industries such as smart cities, smart parks, smart factories and the like.
The efficient organization and management technology of massive two-dimensional GIS data and tile-type terrain landscape data is relatively mature, and the efficient and integrated organization and management of complex massive three-dimensional space model data of large scenes is always a leading-edge difficult problem of research and is also a main technical challenge of the application of the three-dimensional GIS from local range demonstration to city-level comprehensive application. Due to the large data volume of the model, the different geometrical shapes of the three-dimensional space objects and the uneven spatial distribution, the construction of the efficient three-dimensional space index is difficult. On one hand, the data volume of the three-dimensional model of the large city-level scene is huge, so that the data volume is difficult to reduce to a controllable range through a simplification algorithm on the premise of not influencing the display effect of the client; on the other hand, due to the fact that the three-dimensional space objects are sparsely and unevenly distributed, a space index constructed based on a space range division mode is adopted, relatively large model slices can be generated in a region with dense space distribution, and network transmission and front-end rendering efficiency are affected. In the process of constructing the model hierarchical tree, the three-dimensional pyramid construction method based on the division of the number of the triangular patches divides the three-dimensional pyramid by taking the model triangular patches as a unit, so that model components are uniformly distributed in each node of the tree, and the phenomenon of local large slicing based on a space range division mode is avoided; the maximum number of the triangular patches of the single tiles is set, the triangular patches of the member are simplified by adopting an edge folding algorithm combining edge distance and distance weighting, the number of the triangular patches of the single node is limited, and the requirement of displaying a large-scene three-dimensional model of a client is met.
In recent years, scholars at home and abroad make a lot of researches in the field of efficient organization and management of mass three-dimensional spatial data, for example, Chinese patent document CN200910063373.2 proposes a three-dimensional R-tree spatial index method considering multiple levels of detail, a three-dimensional R-tree index structure with expandable multi-level functions is adopted, in the node splitting process, after an insertion target is selected through a k-medoids algorithm, the influence on each layer of nodes on a path tracing to a root node from a selected leaf node is minimal, such as overlapping volume, and the node with the smallest coverage volume increase is taken as an insertion node, so that the problem of spatial overlapping of R-tree indexes is solved, and the method is essentially a three-dimensional spatial index method based on a spatial range and cannot solve the problem of influence on index efficiency caused by uneven spatial distribution of model members; the CN200910063371.3 invention provides a three-dimensional spatial data adaptive multi-level cache system based on data content, the three-dimensional spatial data multi-level cache of the system adopts the design concept of a cache pool, and the three-dimensional spatial data is classified, organized and managed in separate pools in the cache by a three-dimensional spatial data classification method based on data content; the method comprises a three-dimensional space data drawing cache (first-level cache) positioned at a client, a three-dimensional space data memory cache (second-level cache), a three-dimensional space data file cache (third-level cache) and a three-dimensional space data engine service cache (fourth-level cache) positioned at a database server. The four-level caches are respectively controlled by respective cache management modules, the multi-level caches of the client and the database server are uniformly managed through the multi-level cache self-adaptive management module, the caches at all levels are adjusted in a self-adaptive mode, the efficiency of large-scale three-dimensional spatial data dynamic scheduling is improved, model files are cached, and spatial indexes are not utilized.
Therefore, it is necessary to develop a three-dimensional pyramid construction method, which can ensure that the spatial index efficiency is not affected by the spatial distribution of model components, can well generate a level detail model, and can meet the requirement of large-scene three-dimensional model display by using a client rendering scheduling mechanism.
Disclosure of Invention
The invention mainly solves the problem of providing a three-dimensional pyramid construction method based on the number division of triangular patches, which splits the nodes of a model hierarchical tree by using the number information of the triangular patches of a model and taking a member as a unit, can ensure that the nodes of the same level are basically equal in size, and cannot generate the phenomenon of local large slicing.
In order to solve the technical problems, the invention adopts the technical scheme that: the three-dimensional pyramid construction method based on the triangular patch number division specifically comprises the following steps:
s1: respectively setting the maximum number of triangular patches of a single nodeFaceCountParameters and maximum number of triangular patches for a single componentmeshFaceCountA parameter;
s2: reading data of the three-dimensional model, and analyzing geometric, texture and attribute information of the three-dimensional model;
s3: setting maximum depth of binary treeDepthSetting the three-dimensional model read in the step S2 as a root node of the binary tree;
s4: determining coordinate axis direction of node splitting, splitting the binary tree until the depth of the binary tree is greater than or equal toDepthOr the number of the triangular patches of all leaf nodes is less thanFaceCountA parameter;
s5: traversing the binary tree, recalculating the bounding box outside each node of the binary treeBoundingBox(ii) a Merging the components with the same texture in the three-dimensional model, and constructing a component set;
s6: traversing nodes of the binary tree, calculating triangular patch simplification parameters of the current nodes, and simplifying the triangular patches of the nodes by adopting an edge folding algorithm;
s7: recalculating texture coordinates of the simplified triangular patch according to data before and after simplification of the triangular patch;
s8: and outputting the model pyramid data.
By adopting the technical scheme, the model three-dimensional spatial index is constructed by the aid of the three-dimensional pyramid construction method based on the triangular patch number division, the phenomenon of local large tiles can be avoided, the number of the triangular patches of the nodes is dynamically adjusted by setting the maximum number of the triangular patches of the nodes, and network data transmission delay and the calculated amount of client rendering are reduced. In a massive three-dimensional model display scene, because the performance of a GPU of a computer is limited, the fine display of a global model cannot be realized, the number of node triangular patches can be dynamically adjusted according to the GPU calculation power of a scene computer, and the triangular patches of the model are simplified by adopting an edge folding algorithm, so that the effects of fully utilizing the GPU calculation power and meeting the requirement of the global model display are achieved; the effect of automatically adjusting the depth of the tree is achieved by setting the maximum depth of the binary tree and combining the number of the single-node triangular patches, if the maximum depth of the binary tree is set to be 5, and all leaf nodes meet the condition that the number of the node triangular patches is smaller than the set maximum number of the single-node triangular patches before the depth of the binary tree reaches 5, splitting is stopped before the depth of the tree reaches 5, and finally the depth of the tree is not equal to 5; the binary tree is split through the number of the triangular patches of the model, the method does not depend on the space range any more, very large slices cannot appear in a region with high space density of the model, and the model members are guaranteed to be uniformly distributed in all nodes.
As a preferred embodiment of the present invention, the maximum number of triangular patches of a single node is set in step S1FaceCountThe parameter is used as the upper limit value of the number of the triangular patches of the single node of the binary tree; setting maximum triangular patch number of single componentmeshFaceCountThe parameter is used as the upper limit value of the number of the triangular patches of the single component; in the step S2, the texture structure of the three-dimensional model is analyzed and the texture information is stored in the membermaterialOutsourcing box for field, computing root nodeBoundingBox。
As a preferred technical solution of the present invention, the step S4 specifically includes:
s41: dynamically calculating the splitting direction of the binary tree, comparing coordinate ranges of the model in the directions of an X axis, a Y axis and a Z axis, and taking a coordinate axis with the largest difference of the coordinate ranges as the coordinate axis direction of node splitting according to the coordinates of the central point of the component;
s42: sorting the components of the three-dimensional model from small to large according to the coordinates of the central point of the components along the coordinate axis determined in the step S41, traversing the sorted three-dimensional model components, and adding the three-dimensional model components into the components of the current nodeleftSubtree, stopping when the sum of the triangular patches of left subtree member of node is greater than half of total triangular patches of current node, adding the rest members to current noderightA sub-tree;
s43: splitting the binary tree in the coordinate axis direction of the node splitting determined in the step S41 according to the parameters set in the step S1, and iteratively executing the steps S41-42 until the depth of the binary tree is greater than or equal to the depth of the binary treeDepthOr the number of the triangular patches of all leaf nodes is less thanFaceCountAnd (4) parameters.
As a preferred technical solution of the present invention, the step S5 specifically includes: traversing the binary tree, recalculating the bounding box outside each node of the binary treeBoundingBoxThen, the components are merged according to the textures, nodes of the binary tree are traversed, and a component set is constructedMap<material,meshinfo>WhereinmaterialIs made of a texture material, and the texture material,meshinfofor component sets, traverse setsMap<material,meshinfo>To the samematerialMerging corresponding members, if the number of the triangular patches of the current member is more than a set valuemeshFaceCountAnd if the parameters are not the same, stopping the current combination, newly building an empty component, and entering the next combination.
As a preferred technical solution of the present invention, the method for dynamically calculating the splitting direction of the binary tree in step S41 obtains the coordinate range difference of the current binary tree node in each directiondimThe specific calculation method isdim=max-minWhereinmaxIs the maximum value of the coordinate corresponding to the coordinate axis direction,minthe minimum value of the coordinate corresponding to the coordinate axis direction is obtained; if the X-axis direction corresponds todimIf the value is maximum, splitting the current node according to the X-axis direction; if it corresponds to the Y-axis directiondimIf the value is maximum, splitting the current node according to the Y-axis direction; if the Z-axis direction corresponds todimAnd if the value is maximum, splitting the current node according to the Z-axis direction. According to the method, the splitting direction is dynamically adjusted in the node splitting process, and the nodes are ensured to be distributed relatively uniformly in the spatial range.
As a preferred technical solution of the present invention, the splitting method of the binary tree node in step S43 specifically includes: obtaining a component set of a current nodevector<mesh>After the splitting direction of the coordinate axis of the node is determined, model components are collectedvector<mesh>According tomeshThe values of the central points in the direction of the splitting coordinate axis are sorted from small to large; if the direction of the splitting coordinate axis is an X axis, sorting is carried out according to the X coordinate of the central point of the component, if the direction of the splitting coordinate axis is a Y axis, sorting is carried out according to the Y coordinate of the central point of the component, and if the direction of the splitting coordinate axis is a Y axis, sorting is carried out according to the Y coordinate of the central point of the componentIf the component is a Z axis, sorting according to the Z coordinate of the central point of the component; obtaining the number of the triangular patches of the current nodetotalFaceCountBuilding two empty subtreesleftAndrightrespectively corresponding to the left and right subtrees of the current node; traversing a set of componentsvector<mesh>Adding a component intoleftSubtree, ifleftThe number of subtree triangular surface patches is more thantotalFaceCount Stopping at 2, adding the rest of the componentsrightAnd a subtree for executing the above steps iteratively, if the depth of the binary tree is greater than or equal to the set maximum depthDepthOr the number of the triangular patches of all leaf nodes is less thanFaceCountThe splitting is stopped.
As a preferred technical solution of the present invention, the step S6 specifically includes:
s61: traversing nodes of the binary tree, and calculating a triangular patch simplification parameter of a current node, wherein the calculation formula is as follows:;
whereinFaceCountFor the maximum number of triangular patches of the single node of the binary tree set in step S1,totalFaceCountthe total number of the actual triangular patches of the current node is; if it isdecimationRatioIf the number is more than 1, skipping the triangular patch simplification step; if it isdecimationRatioLess than 1, according to the parametersdecimationRatioThe value of (2) is obtained by adopting a quadratic error edge folding algorithm to carry out triangular patch simplification on the current node;
s62: computing componentedgeCollapse authority ofpriorityThe edge distance islength,edgeCollapse pointpointToedgeThe distance average of the associated triangular patch isdistance(ii) a Update all of the componentsedgeCollapse authority ofpriorityAccording topriorityFrom small to bigedgeProceed sorting, traverseedgeCollecting and executing simplification operation until the number ratio of front triangular patch to rear triangular patch is less thandecimationRatio。
As a preferred technical solution of the present invention, the specific steps of performing triangle patch simplification on the current node by using an edge folding algorithm with edge distance and distance weighting in step S61 are as follows:
s611: counting all edges participating in folding, wherein the edges are a set of all triangular patch edges of the current component;
s612: computing all verticesvMeasurement error ofPriority(v)Let us assume the edgeeRespectively is、Then, then;
s614: folding the edge, and taking the center point of the edge as a new vertexDeleting vertices、Deleting edgeseVertex, point、Associated triangular patch vertex update toUpdating verticesAnd withAssociated edgesPriorityA value;
s615: repeating the steps S613 to S614 untildecimationRatioGreater than 1.
As a preferred embodiment of the present invention, the step S612priorityThe calculation method comprises the following steps:
priority=distance* length;
whereinedgeThe endpoint coordinates of (a) are:p1,p2then, thenlengthThe algorithm of (1) is as follows:
dx=p1.x()-p2.x();
dy=p1.y()-p2.y();
dz=p1.z()-p2.z();
length=sqrt(dx*dx+dy*dy+dz*dz);
whereinp1.x()Andp2.x()respectively representing pointsp1Andp2is/are as followsxThe coordinates of the position of the object to be imaged,p1.y()andp2.y()respectively representing pointsp1Andp2is/are as followsyThe coordinates of the position of the object to be imaged,p1.z()andp2.z()respectively representing pointsp1Andp2is/are as followszThe coordinates of the position of the object to be imaged,sqrtis an evolution function;
trianglesis composed ofedgeAssociated set of triangular patches, thendistanceThe algorithm is as follows:
whereinAs folding pointspoint To edge Correlated triangular patch i The Euclidean distance of;n is composed of trianglesThe size of the collection.
Compared with the prior art, the three-dimensional pyramid construction method based on the triangular patch number division has the following advantages: the nodes are not strictly split according to the spatial range, and the node splitting direction is dynamically determined by calculating the maximum difference value of the model coordinates in each coordinate axis, so that large slices which are difficult to process in an area with high model spatial density are avoided, model components are uniformly distributed in each node, and sub-nodes of the model are relatively uniformly distributed in space; model components with the same texture are combined, and the characteristics of the original components can be better reserved after the triangular patch is simplified; according to the performance of the display card, the maximum number parameter of the triangular patches of the single node is set, the triangular patches are simplified by using the edge collapse algorithm, the number of the triangular patches of the single slice can be accurately controlled, and the requirement of large-scene three-dimensional model display is met.
Drawings
FIG. 1 is a flow chart of a three-dimensional pyramid construction method based on triangular patch number division according to the present invention;
FIG. 2 is an original model of a three-dimensional pyramid construction method based on triangular patch number division according to the present invention;
FIG. 3 is a 1 st-level pyramid model of the three-dimensional pyramid construction method based on the number division of triangular patches according to the present invention;
fig. 4a and 4b are 2 nd-level pyramid models of the three-dimensional pyramid construction method based on the number division of the triangular patches according to the present invention;
fig. 5a, 5b, 5c and 5d are 3 rd-level pyramid models of the three-dimensional pyramid construction method based on the number of triangular patches;
fig. 6a, 6b, 6c, 6d, 6e, 6f, 6g and 6h are 4 th-level pyramid models of the three-dimensional pyramid construction method based on the number of triangular patches;
fig. 7a, 7b, 7c, 7d, 7e, 7f, 7g, 7h, 7i, 7j, 7k, 7l, 7m, 7n, 7o and 7p are 5 th-level pyramid models of the three-dimensional pyramid construction method based on triangular patch number division according to the present invention.
Detailed Description
The technical solution in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the drawings of the embodiments of the present invention.
Example (b): as shown in fig. 1-2, the three-dimensional pyramid construction method based on the number division of the triangular patches specifically includes the following steps:
s1: respectively setting the maximum number of triangular patches of a single nodeFaceCountParameters and maximum number of triangular patches for a single componentmeshFaceCountA parameter;
setting the maximum number of triangular patches of a single node in the step S1FaceCountThe parameter is 256000, and the parameter is used as the upper limit value of the number of the triangular patches of the single node of the binary tree; in the process of simplifying and combining the triangular patches, the number of the simplified node triangular faces is adjusted according to the FaceCount parameter; setting maximum triangular patch number of single componentmeshFaceCountThe parameter is 65536, and the parameter is used as the upper limit value of the number of the triangular patches of the single component; when the components are combined,meshFaceCountensuring that the combined member does not have excessive triangular patches;
s2: reading data of the three-dimensional model by using a tinygltf open source library, and analyzing geometric, texture and attribute information of the three-dimensional model; in the step S2, the texture structure of the three-dimensional model is analyzed and the texture information is stored in the membermaterialOutsourcing box for field, computing root nodeBoundingBox(ii) a The analyzed model information is stored through a vcglib library;
s3: setting maximum depth of binary treeDepth5, and setting the three-dimensional model read in the step S2 as a root node of the binary tree;
s4: determining coordinate axis direction of node splitting, splitting the binary tree until the depth of the binary tree is greater than or equal toDepthOr the number of the triangular patches of all leaf nodes is less thanFaceCountA parameter;
the step S4 specifically includes:
s41: dynamically calculating the splitting direction of the binary tree, comparing coordinate ranges of the model in the directions of an X axis, a Y axis and a Z axis, and taking a coordinate axis with the largest difference of the coordinate ranges as the coordinate axis direction of node splitting according to the coordinates of the central point of the component;
the method for dynamically calculating the splitting direction of the binary tree in step S41 obtains the coordinate range difference of the current binary tree node in each directiondimThe specific calculation method isdim=max-minWhereinmaxIs the maximum value of the coordinate corresponding to the coordinate axis direction,minthe minimum value of the coordinate corresponding to the coordinate axis direction is obtained; if the X-axis direction corresponds todimIf the value is maximum, splitting the current node according to the X-axis direction; if it corresponds to the Y-axis directiondimIf the value is maximum, splitting the current node according to the Y-axis direction; if the Z-axis direction corresponds todimIf the value is maximum, splitting the current node according to the Z-axis direction; according to the method, the splitting direction is dynamically adjusted in the node splitting process, and the nodes are ensured to be distributed relatively uniformly in the spatial range;
s42: sorting the components of the three-dimensional model from small to large according to the coordinates of the central point of the components along the coordinate axis determined in the step S41, traversing the sorted three-dimensional model components, and adding the three-dimensional model components into the components of the current nodeleftSubtree, stopping when the sum of the triangular patches of left subtree member of node is greater than half of total triangular patches of current node, adding the rest members to current noderightA sub-tree;
s43: splitting the binary tree in the coordinate axis direction of the node splitting determined in the step S41 according to the parameters set in the step S1, and iteratively executing the steps S41-42 until the depth of the binary tree is greater than or equal to the depth of the binary treeDepthOr the number of the triangular patches of all leaf nodes is less thanFaceCountA parameter;
the splitting method of the binary tree node in the step S43 specifically includes: obtaining a component set of a current nodevector<mesh>After the splitting direction of the coordinate axis of the node is determined, model components are collectedvector<mesh>According tomeshThe values of the central points in the direction of the splitting coordinate axis are sorted from small to large; if the direction of the splitting coordinate axis is an X axis, sorting is carried out according to the X coordinate of the member center point, if the direction of the splitting coordinate axis is a Y axis, sorting is carried out according to the Y coordinate of the member center point, and if the direction of the splitting coordinate axis is a Z axis, sorting is carried out according to the Z coordinate of the member center point; obtaining the number of the triangular patches of the current nodetotalFaceCountBuilding two empty subtreesleftAndrightrespectively corresponding to the left and right subtrees of the current node; traversing a set of componentsvector<mesh>Adding a component intoleftSubtree, ifleftThe number of subtree triangular surface patches is more thantotalFaceCount Stopping at 2, adding the rest of the componentsrightAnd a subtree for executing the above steps iteratively, if the depth of the binary tree is greater than or equal to the set maximum depthDepthOr the number of the triangular patches of all leaf nodes is less thanFaceCountStopping splitting;
s5: traversing the binary tree, recalculating the bounding box outside each node of the binary treeBoundingBox(ii) a Merging the components with the same texture in the three-dimensional model, and constructing a component set;
the step S5 specifically includes: traversing the binary tree, recalculating the bounding box outside each node of the binary treeBoundingBoxThen, the components are merged according to the textures, nodes of the binary tree are traversed, and a component set is constructedMap<material, meshinfo>WhereinmaterialIs made of a texture material, and the texture material,meshinfofor component sets, traverse setsMap<material, meshinfo>To the samematerialMerging corresponding members, if the number of the triangular patches of the current member is more than a set valuemeshFaceCountIf the parameters are the same, stopping current combination, newly building an empty component, and entering the next round of combination;
s6: traversing nodes of the binary tree, calculating triangular patch simplification parameters of the current nodes, and simplifying the triangular patches of the nodes by adopting a secondary error edge folding algorithm; the model component is simplified by using a vcglib open source library integrated triangular patch simplification algorithm;
the step S6 specifically includes:
s61: traversing nodes of the binary tree, and calculating a triangular patch simplification parameter of a current node, wherein the calculation formula is as follows:;
whereinFaceCountFor the maximum number of triangular patches of the single node of the binary tree set in step S1,totalFaceCountthe total number of the actual triangular patches of the current node is; if it isdecimationRatioIf the number is more than 1, skipping the triangular patch simplification step; if it isdecimationRatioLess than 1, according to the parametersdecimationRatioThe value of (a) is,performing triangular patch simplification on the current node by adopting a quadratic error edge folding algorithm;
the specific steps of performing triangle patch simplification on the current node by using the edge folding algorithm with edge distance and distance weighting in step S61 are as follows:
s611: counting all edges participating in folding, wherein the edges are a set of all triangular patch edges of the current component;
s612: computing all verticesvMeasurement error ofPriority(v)Let us assume the edgeeRespectively is、Then, then;
WhereinpriorityThe calculation method comprises the following steps:
priority=distance* length;
whereinedgeThe endpoint coordinates of (a) are:p1,p2then, thenlengthThe algorithm of (1) is as follows:
dx=p1.x()-p2.x();
dy=p1.y()-p2.y();
dz=p1.z()-p2.z();
length=sqrt(dx*dx+dy*dy+dz*dz);
whereinp1.x()Andp2.x()respectively representing pointsp1Andp2is/are as followsxThe coordinates of the position of the object to be imaged,p1.y()andp2.y()respectively representing pointsp1Andp2is/are as followsyThe coordinates of the position of the object to be imaged,p1.z()andp2.z()respectively representing pointsp1Andp2is/are as followszThe coordinates of the position of the object to be imaged,sqrtis an evolution function;
trianglesis composed ofedgeAssociated set of triangular patches, thendistanceThe algorithm is as follows:
whereinAs folding pointspoint To edge Correlated triangular patch i The Euclidean distance of;n is composed of trianglesThe size of the set;
s614: folding the edge, and taking the center point of the edge as a new vertexDeleting vertices、Deleting edgeseVertex, point、Associated triangular patch vertex update toUpdating verticesAnd withAssociated edgesPriorityA value;
s615: repeating the steps S613 to S614 untildecimationRatioGreater than 1;
s62: computing componentedgeCollapse authority ofpriorityThe edge distance islength,edgeCollapse pointpointToedgeThe distance average of the associated triangular patch isdistance(ii) a Update all of the componentsedgeCollapse authority ofpriorityAccording topriorityFrom small to bigedgeProceed sorting, traverseedgeCollecting and executing simplification operation until the number ratio of front triangular patch to rear triangular patch is less thandecimationRatio。
S7: recalculating texture coordinates of the simplified triangular patch according to data before and after simplification of the triangular patch;
s8: outputting model pyramid data, namely outputting pyramid data in tileset json and b3dm formats, for rendering by a client, wherein the three-dimensional model pyramids of level 1 to level 5 generated after simplification are respectively as shown in fig. 3 (level 1), fig. 4a to fig. 4b (level 2), fig. 5a to fig. 5d (level 3), fig. 6a to fig. 6h (level 4) to fig. 7a to fig. 7p (level 5).
By adopting the technical scheme, the model three-dimensional spatial index is constructed by the aid of the three-dimensional pyramid construction method based on the triangular patch number division, the phenomenon of local large tiles can be avoided, the number of the triangular patches of the nodes is dynamically adjusted by setting the maximum number of the triangular patches of the nodes, and network data transmission delay and the calculated amount of client rendering are reduced. In a massive three-dimensional model display scene, because the performance of a GPU of a computer is limited, the fine display of a global model cannot be realized, the number of node triangular patches can be dynamically adjusted according to the GPU calculation power of a scene computer, and the triangular patches of the model are simplified by adopting an edge folding algorithm, so that the effects of fully utilizing the GPU calculation power and meeting the requirement of the global model display are achieved; the effect of automatically adjusting the depth of the tree is achieved by setting the maximum depth of the binary tree and combining the number of the single-node triangular patches, if the maximum depth of the binary tree is set to be 5, and all leaf nodes meet the condition that the number of the node triangular patches is smaller than the set maximum number of the single-node triangular patches before the depth of the binary tree reaches 5, splitting is stopped before the depth of the tree reaches 5, and finally the depth of the tree is not equal to 5; the binary tree is split through the number of the triangular patches of the model, the method does not depend on the space range any more, very large slices cannot appear in a region with high space density of the model, and the model members are guaranteed to be uniformly distributed in all nodes.
The above description is only exemplary of the present invention and should not be taken as limiting the invention, as any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.
Claims (9)
1. A three-dimensional pyramid construction method based on triangular patch number division is characterized by comprising the following steps:
s1: respectively setting the maximum number of triangular patches of a single nodeFaceCountParameters and maximum number of triangular patches for a single componentmeshFaceCountA parameter;
s2: reading data of the three-dimensional model, and analyzing geometric, texture and attribute information of the three-dimensional model;
s3: setting maximum depth of binary treeDepthSetting the three-dimensional model read in the step S2 as a root node of the binary tree;
s4: determining coordinate axis direction of node splitting, splitting the binary tree until the depth of the binary tree is greater than or equal toDepthOr the number of the triangular patches of all leaf nodes is less thanFaceCountA parameter;
s5: traversing the binary tree, recalculating the bounding box outside each node of the binary treeBoundingBox(ii) a Merging the components with the same texture in the three-dimensional model, and constructing a component set;
s6: traversing nodes of the binary tree, calculating triangular patch simplification parameters of the current nodes, and simplifying the triangular patches of the nodes by adopting an edge folding algorithm;
s7: recalculating texture coordinates of the simplified triangular patch according to data before and after simplification of the triangular patch;
s8: and outputting the model pyramid data.
2. The method of claim 1, wherein the method comprises constructing a three-dimensional pyramid based on triangular patch number partitionsCharacterized in that the maximum number of triangle patches of a single node is set in the step S1FaceCountThe parameter is used as the upper limit value of the number of the triangular patches of the single node of the binary tree; setting maximum triangular patch number of single componentmeshFaceCountThe parameter is used as the upper limit value of the number of the triangular patches of the single component; in the step S2, the texture structure of the three-dimensional model is analyzed and the texture information is stored in the membermaterialOutsourcing box for field, computing root nodeBoundingBox。
3. The method for constructing a three-dimensional pyramid based on the number division of triangular patches of claim 2, wherein the step S4 specifically comprises:
s41: dynamically calculating the splitting direction of the binary tree, comparing coordinate ranges of the model in the directions of an X axis, a Y axis and a Z axis, and taking a coordinate axis with the largest difference of the coordinate ranges as the coordinate axis direction of node splitting according to the coordinates of the central point of the component;
s42: sorting the components of the three-dimensional model from small to large according to the coordinates of the central point of the components along the coordinate axis determined in the step S41, traversing the sorted three-dimensional model components, and adding the three-dimensional model components into the components of the current nodeleftSubtree, stopping when the sum of the triangular patches of left subtree member of node is greater than half of total triangular patches of current node, adding the rest members to current noderightA sub-tree;
s43: splitting the binary tree in the coordinate axis direction of the node splitting determined in the step S41 according to the parameters set in the step S1, and iteratively executing the steps S41-42 until the depth of the binary tree is greater than or equal to the depth of the binary treeDepthOr the number of the triangular patches of all leaf nodes is less thanFaceCountAnd (4) parameters.
4. The method for constructing a three-dimensional pyramid based on the number division of triangular patches according to claim 3, wherein the step S5 specifically comprises: traversing the binary tree, recalculating the bounding box outside each node of the binary treeBoundingBoxThen, the components are merged according to the textures, nodes of the binary tree are traversed, and a component set is constructedMap<material,meshinfo>WhereinmaterialIs made of a texture material, and the texture material,meshinfofor component sets, traverse setsMap<material,meshinfo>To the samematerialMerging corresponding members, if the number of the triangular patches of the current member is more than a set valuemeshFaceCountAnd if the parameters are not the same, stopping the current combination, newly building an empty component, and entering the next combination.
5. The method for constructing a three-dimensional pyramid based on the number division of triangular patches of claim 3, wherein the method for dynamically calculating the splitting direction of the binary tree in step S41 obtains the coordinate range difference of the current nodes of the binary tree in each directiondimThe specific calculation method isdim=max-minWhereinmaxIs the maximum value of the coordinate corresponding to the coordinate axis direction,minthe minimum value of the coordinate corresponding to the coordinate axis direction is obtained; if the X-axis direction corresponds todimIf the value is maximum, splitting the current node according to the X-axis direction; if it corresponds to the Y-axis directiondimIf the value is maximum, splitting the current node according to the Y-axis direction; if the Z-axis direction corresponds todimAnd if the value is maximum, splitting the current node according to the Z-axis direction.
6. The method for constructing a three-dimensional pyramid based on the number division of triangular patches of claim 5, wherein the splitting method of the nodes of the binary tree of step S43 is specifically: obtaining a component set of a current nodevector<mesh>After the splitting direction of the coordinate axis of the node is determined, model components are collectedvector<mesh>According tomeshThe values of the central points in the direction of the splitting coordinate axis are sorted from small to large; if the direction of the splitting coordinate axis is an X axis, sorting is carried out according to the X coordinate of the member center point, if the direction of the splitting coordinate axis is a Y axis, sorting is carried out according to the Y coordinate of the member center point, and if the direction of the splitting coordinate axis is a Z axis, sorting is carried out according to the Z coordinate of the member center point; obtaining the number of the triangular patches of the current nodetotalFaceCountBuilding two empty subtreesleftAndrightrespectively corresponding to the left and right subtrees of the current node; traversing a set of componentsvector<mesh>Adding a component intoleftSubtree, ifleftThe number of subtree triangular surface patches is more thantotalFaceCount Stopping at 2, adding the rest of the componentsrightAnd a subtree for executing the above steps iteratively, if the depth of the binary tree is greater than or equal to the set maximum depthDepthOr the number of the triangular patches of all leaf nodes is less thanFaceCountThe splitting is stopped.
7. The method for constructing a three-dimensional pyramid based on the number division of triangular patches according to claim 5, wherein the step S6 specifically comprises:
s61: traversing nodes of the binary tree, and calculating a triangular patch simplification parameter of a current node, wherein the calculation formula is as follows:;
whereinFaceCountFor the maximum number of triangular patches of the single node of the binary tree set in step S1,totalFaceCountthe total number of the actual triangular patches of the current node is; if it isdecimationRatioIf the number is more than 1, skipping the triangular patch simplification step; if it isdecimationRatioLess than 1, according to the parametersdecimationRatioThe value of (2) is obtained by adopting a quadratic error edge folding algorithm to carry out triangular patch simplification on the current node;
s62: computing componentedgeCollapse authority ofpriorityThe edge distance islength,edgeCollapse pointpointToedgeThe distance average of the associated triangular patch isdistance(ii) a Update all of the componentsedgeCollapse authority ofpriorityAccording topriorityFrom small to bigedgeProceed sorting, traverseedgeCollecting and executing simplification operation until the number ratio of front triangular patch to rear triangular patch is less thandecimationRatio。
8. The method for constructing a three-dimensional pyramid based on triangular patch number division according to claim 7, wherein the specific steps of performing triangular patch simplification on the current node by using an edge folding algorithm in step S61 are as follows:
s611: counting all edges participating in folding, wherein the edges are a set of all triangular patch edges of the current component;
s612: computing all verticesvMeasurement error ofPriority(v)Let us assume the edgeeRespectively is、Then, then;
s614: folding the edge, and taking the center point of the edge as a new vertexDeleting vertices、Deleting edgeseVertex, point、Associated triangular patch vertex update toUpdating verticesAnd withAssociated edgesPriorityA value;
s615: repeating the steps S613 to S614 untildecimationRatioGreater than 1.
9. The method for constructing a three-dimensional pyramid based on the number of triangular patches divided according to claim 7, wherein the step S612 comprisespriorityThe calculation method comprises the following steps:
priority=distance* length;
whereinedgeThe endpoint coordinates of (a) are:p1,p2then, thenlengthThe algorithm of (1) is as follows:
dx=p1.x()-p2.x();
dy=p1.y()-p2.y();
dz=p1.z()-p2.z();
length=sqrt(dx*dx+dy*dy+dz*dz);
whereinp1.x()Andp2.x()respectively representing pointsp1Andp2is/are as followsxThe coordinates of the position of the object to be imaged,p1.y()andp2.y()respectively representing pointsp1Andp2is/are as followsyThe coordinates of the position of the object to be imaged,p1.z()andp2.z()respectively representing pointsp1Andp2is/are as followszThe coordinates of the position of the object to be imaged,sqrtis an evolution function;
trianglesis composed ofedgeAssociated set of triangular patches, thendistanceThe algorithm is as follows:
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111024709.1A CN113468286A (en) | 2021-09-02 | 2021-09-02 | Three-dimensional pyramid construction method based on triangular patch number division |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202111024709.1A CN113468286A (en) | 2021-09-02 | 2021-09-02 | Three-dimensional pyramid construction method based on triangular patch number division |
Publications (1)
Publication Number | Publication Date |
---|---|
CN113468286A true CN113468286A (en) | 2021-10-01 |
Family
ID=77868054
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202111024709.1A Pending CN113468286A (en) | 2021-09-02 | 2021-09-02 | Three-dimensional pyramid construction method based on triangular patch number division |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN113468286A (en) |
Cited By (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113888716A (en) * | 2021-10-08 | 2022-01-04 | 广东工业大学 | Scene lightweight method for digital twinning |
CN114168530A (en) * | 2021-12-10 | 2022-03-11 | 深圳市毕美科技有限公司 | Three-dimensional data storage method, device, equipment and storage medium |
CN114863040A (en) * | 2022-07-11 | 2022-08-05 | 北京飞渡科技有限公司 | LOD tree construction method and device for texture-dense three-dimensional scene and electronic equipment |
-
2021
- 2021-09-02 CN CN202111024709.1A patent/CN113468286A/en active Pending
Cited By (5)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN113888716A (en) * | 2021-10-08 | 2022-01-04 | 广东工业大学 | Scene lightweight method for digital twinning |
CN113888716B (en) * | 2021-10-08 | 2022-04-01 | 广东工业大学 | Scene lightweight method for digital twinning |
CN114168530A (en) * | 2021-12-10 | 2022-03-11 | 深圳市毕美科技有限公司 | Three-dimensional data storage method, device, equipment and storage medium |
CN114863040A (en) * | 2022-07-11 | 2022-08-05 | 北京飞渡科技有限公司 | LOD tree construction method and device for texture-dense three-dimensional scene and electronic equipment |
CN114863040B (en) * | 2022-07-11 | 2022-09-13 | 北京飞渡科技有限公司 | LOD tree construction method and device for texture-dense three-dimensional scene and electronic equipment |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US11481954B2 (en) | Systems and methods for 3-D scene acceleration structure creation and updating | |
CN113468286A (en) | Three-dimensional pyramid construction method based on triangular patch number division | |
CN107025685B (en) | Airborne building roof point cloud modeling method under topology perception | |
US8570322B2 (en) | Method, system, and computer program product for efficient ray tracing of micropolygon geometry | |
Ji et al. | A novel simplification method for 3D geometric point cloud based on the importance of point | |
CN102890828B (en) | Point cloud data compacting method based on normal included angle | |
Floriani et al. | Variant: A system for terrain modeling at variable resolution | |
CN102509339B (en) | Method for simplifying vertex clustering of three-dimensional models with texture constraint | |
WO2022121525A1 (en) | Method and device for rendering three-dimensional scene data, storage medium, and electronic device | |
CN108765538B (en) | Method for hierarchical rendering of OSGB data based on CAD platform | |
Gong et al. | An efficient point cloud management method based on a 3D R-tree | |
CN115661374B (en) | Rapid retrieval method based on space division and model voxelization | |
CN110533778A (en) | Large Scale Graphs picture point cloud parallel distributed gridding reconstruction method, system, device | |
CN105957148A (en) | Granularity balance data organization method of complicated three-dimensional building model | |
She et al. | 3D building model simplification method considering both model mesh and building structure | |
Shan et al. | Interactive visual exploration of halos in large-scale cosmology simulation | |
He et al. | All range and heterogeneous multi-scale 3D city models | |
Zhang | The D-FCM partitioned D-BSP tree for massive point cloud data access and rendering | |
CN117009411A (en) | Method, device and computer readable storage medium for meshing space storage and indexing based on point cloud data | |
Fellegara et al. | Terrain trees: a framework for representing, analyzing and visualizing triangulated terrains | |
CN111915720B (en) | Automatic conversion method from building Mesh model to CityGML model | |
CN110111407B (en) | Scheduling rendering method and system for massive three-dimensional grid data | |
Jun-Feng et al. | Parallel optimization of the ray-tracing algorithm based on the HPM model | |
Tian et al. | Roaming of large urban scenes based on Unity 3D | |
CN104933189B (en) | Figure of buddha surface sampled data R tree optimization method based on the division of node center excursD |
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 |