CN114529648A - Model display method, device, apparatus, electronic device and storage medium - Google Patents
Model display method, device, apparatus, electronic device and storage medium Download PDFInfo
- Publication number
- CN114529648A CN114529648A CN202210153040.4A CN202210153040A CN114529648A CN 114529648 A CN114529648 A CN 114529648A CN 202210153040 A CN202210153040 A CN 202210153040A CN 114529648 A CN114529648 A CN 114529648A
- Authority
- CN
- China
- Prior art keywords
- model
- node
- information
- dimensional
- target
- 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
- G06T—IMAGE DATA PROCESSING OR GENERATION, IN GENERAL
- G06T15/00—3D [Three Dimensional] image rendering
-
- 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/005—Tree description, e.g. octree, quadtree
Landscapes
- Engineering & Computer Science (AREA)
- Physics & Mathematics (AREA)
- Computer Graphics (AREA)
- General Physics & Mathematics (AREA)
- Theoretical Computer Science (AREA)
- Geometry (AREA)
- Software Systems (AREA)
- Processing Or Creating Images (AREA)
Abstract
The disclosure provides a model display method, equipment, a device, electronic equipment and a storage medium, wherein the method comprises the following steps: acquiring octree information corresponding to each three-dimensional model in a target scene; wherein the octree information includes a plurality of nodes; the three-dimensional region represented by each node comprises a local model on the three-dimensional model; the fineness of the local model included by the node is positively correlated with the node depth of the node; the local model with high fineness comprises the number of vertexes, and the number of vertexes is larger than that of the local model with low fineness; determining area information of a visual area of a virtual camera based on current shooting parameter information of the virtual camera for shooting a three-dimensional model in the target scene; and determining a target local model included in at least one node positioned in the visualization region based on the octree information and the region information respectively corresponding to each three-dimensional model included in the target scene.
Description
Technical Field
The present disclosure relates to the field of three-dimensional model technologies, and in particular, to a model display method, device, apparatus, electronic device, and storage medium.
Background
With the development of technology, more and more scenes need to be rendered with three-dimensional models; such as Augmented Reality (AR), Virtual Reality (VR), digital twin projects, etc. The device can generate a model file corresponding to each three-dimensional model, and store the model files of the three-dimensional models in the memory, so that the device can render and display the three-dimensional models by using the model files acquired from the memory.
Generally, a model file corresponding to a three-dimensional model can be generated by using a three-dimensional reconstruction algorithm, and the data capacity of the model file generated by the three-dimensional reconstruction algorithm is large, if more three-dimensional models need to be rendered in a scene and the memory capacity of a device for rendering and displaying is small, the model file of each three-dimensional model is loaded into a memory, so that the device with small memory capacity cannot render and display each three-dimensional model, and inconvenience is brought to the rendering and displaying of each three-dimensional model.
Disclosure of Invention
In view of the above, the present disclosure at least provides a model display method, device, apparatus, electronic device and storage medium.
In a first aspect, the present disclosure provides a model display method, including:
acquiring octree information corresponding to each three-dimensional model included in a target scene; wherein the octree information comprises a plurality of nodes; each three-dimensional region characterized by a node comprises a local model on the three-dimensional model; the fineness of a local model included by the node is positively correlated with the node depth of the node; the local model with high fineness comprises the number of vertexes, and the number of vertexes is larger than that of the local model with low fineness;
determining area information of a visual area of a virtual camera based on current shooting parameter information of the virtual camera for shooting a three-dimensional model in the target scene;
and determining a target local model included in at least one node positioned in the visualization region based on the octree information and the region information respectively corresponding to each three-dimensional model included in the target scene.
In the method, octree information corresponding to each three-dimensional model in a target scene is acquired; the octree information comprises a plurality of nodes, and a three-dimensional region represented by each node comprises a local model on a three-dimensional model; that is, the three-dimensional model is divided into a plurality of local models, and each local model corresponds to one node in the octree. After the area information of the visual area of the virtual camera is determined based on the current shooting parameter information of the virtual camera, the target local model in the visual area can be determined more efficiently and accurately based on the area information of the current visual area of the virtual camera and the octree information of each three-dimensional model, the refined rendering display of each three-dimensional model is realized, and the display flexibility of the three-dimensional model is improved.
In a possible implementation manner, the obtaining octree information corresponding to each three-dimensional model included in the target scene includes:
obtaining model information of each three-dimensional model included in a target scene;
and generating octree information corresponding to the three-dimensional models based on the model information corresponding to each three-dimensional model.
By using the acquired model information of each three-dimensional model in the target scene, octree information corresponding to the three-dimensional model can be generated accurately, data support is provided for subsequent determination of the target local model, and refined display of each three-dimensional model in the target scene is realized.
In a possible embodiment, the generating octree information corresponding to each three-dimensional model based on the model information corresponding to the three-dimensional model includes:
generating initial octree information corresponding to the three-dimensional models based on the model information corresponding to each three-dimensional model; wherein, the three-dimensional region represented by each node in the initial octree information comprises an original local model corresponding to the three-dimensional model; the original local model comprises a plurality of vertexes and a plurality of meshes formed by the connection relations among the vertexes;
determining a vertex to be deleted in an original local model corresponding to each node in the initial octree information, and generating a local model corresponding to the node based on other vertexes except the vertex to be deleted in a plurality of vertexes included in the original local model;
and generating octree information corresponding to the three-dimensional model based on the local model information of the local model corresponding to each node.
In the embodiment of the disclosure, for each node in the generated initial octree information, a vertex to be deleted in the original local model corresponding to the node is determined, and a local model corresponding to the node is generated based on other vertexes, except the vertex to be deleted, in the multiple vertexes included in the original local model, wherein the model precision of the local model after the vertex deletion is lower than that of the original local model not deleted, so that the model precision of the model corresponding to the node is reduced, and then, based on the local model information of the local model corresponding to each node, octree information corresponding to the three-dimensional model can be generated more accurately, so that the octree information corresponding to the three-dimensional model can be subsequently utilized, the target local model located in the visualization area can be determined more accurately, and the refined display of the three-dimensional model is realized.
In a possible embodiment, the generating initial octree information corresponding to each three-dimensional model based on the model information corresponding to the three-dimensional model includes:
taking the three-dimensional model as a target model, and dividing a three-dimensional area corresponding to the target model into eight sub three-dimensional areas according to a set dividing mode on the basis of model information of the target model; the node corresponding to the three-dimensional region of the three-dimensional model is a root node, and the node information of the root node comprises model information of the three-dimensional model; each sub three-dimensional area corresponds to one sub node; the node information of each child node includes: model information or preset information of the original local model located in the sub-three-dimensional region corresponding to the node;
when the child nodes meeting the preset conditions exist, the original local model included in the child nodes meeting the preset conditions is used as a target model, model information based on the target model is returned, and the three-dimensional region corresponding to the target model is divided into eight sub three-dimensional regions according to the set dividing mode until the divided child nodes do not meet the preset conditions; wherein, the child node satisfying the preset condition includes: the node depth is smaller than the child nodes of the set depth threshold value, and/or the number of vertexes in the model information included in the node information is larger than the child nodes of the set number threshold value;
and generating initial octree information corresponding to the three-dimensional model based on the generated node information of the root node and the node information of each child node.
Here, by taking the three-dimensional model as a target model, the three-dimensional region corresponding to the target model is divided into eight sub three-dimensional regions according to the set division mode based on the model information of the target model; and setting a preset condition, dividing the child nodes when determining that the child nodes meeting the preset condition exist, and obtaining the node information of the root node and the node information of each child node until the obtained divided child nodes do not meet the preset condition. And then, based on the node information of the root node and the node information of each child node, the initial octree information corresponding to the three-dimensional model is generated more accurately.
In a possible embodiment, the determining vertices to be deleted in the original local model corresponding to the node includes:
determining normal similarity between normals respectively corresponding to a plurality of grids indicated by the model information based on the model information of the original local model included by the node;
and determining the vertex to be deleted in the original local model corresponding to the node based on the normal similarity between the normals respectively corresponding to the grids.
Here, the normal similarity between the normals respectively corresponding to the multiple meshes indicated by the model information is determined based on the model information of the original local model corresponding to the node; determining a vertex to be deleted from a plurality of vertexes of the original local model more conveniently based on the normal similarity between the normals respectively corresponding to the grids; and then, generating a local model corresponding to the node based on other vertexes except the vertex to be deleted in the plurality of vertexes, so that the original local model is simplified, and the efficiency of simplifying the three-dimensional model is improved.
In a possible implementation manner, the determining, based on the normal similarity between the normals respectively corresponding to the multiple meshes, a vertex to be deleted in the original local model corresponding to the node includes:
traversing each vertex of the original local model, and determining a target mesh comprising the traversed vertex aiming at the traversed vertex;
comparing the normal similarity between the normals corresponding to the target grid with a normal similarity threshold corresponding to the node; wherein the normal similarity threshold corresponding to the node is positively correlated with the node depth corresponding to the node;
and determining the traversed vertex as a vertex to be deleted in response to the normal similarity being greater than or equal to the normal similarity threshold.
Therefore, the boundary of the top point deletion is limited through the normal similarity threshold with controllable numerical value, so that the simplification fineness of the original local model is controllable, the precision of the simplified local model is guaranteed, and the model simplification efficiency is improved.
In a possible implementation manner, the determining, based on the octree information and the region information respectively corresponding to the three-dimensional models included in the target scene, a target local model included in at least one node located in the visualization region includes:
determining at least one target three-dimensional model located within the visualization area based on the area information, the display pose and the model size of each three-dimensional model included in the target scene;
and determining a target local model included by at least one node in the visualization region based on the octree information corresponding to the target three-dimensional model and the region information.
In the embodiment of the disclosure, at least one target three-dimensional model located in a visual area is determined based on the area information, the display pose of each three-dimensional model included in the target scene and the model size; and then, according to the octree information and the region information corresponding to the target three-dimensional model, the target local model included by at least one node in the visual region is accurately determined, and the determination process of the target local model is simple and convenient and has high efficiency.
In a possible embodiment, the determining, based on the octree information corresponding to the target three-dimensional model and the region information, a target local model included in at least one node in the visualization region includes:
taking a root node in the octree information corresponding to the target three-dimensional model as a node to be processed, and determining whether a three-dimensional region corresponding to the node to be processed is completely located in a visual region indicated by the region information;
under the condition that the three-dimensional region corresponding to the node to be processed is partially located in the visualization region, taking each sub-node connected with the node to be processed as the node to be processed, and returning to the step of determining whether the three-dimensional region corresponding to the node to be processed is completely located in the visualization region indicated by the region information until the three-dimensional region corresponding to the node to be processed is completely located in the visualization region;
and under the condition that the three-dimensional region corresponding to the node to be processed is completely positioned in the visualization region, determining the local model included by the node to be processed as a target local model included by the node positioned in the visualization region.
In the above manner, by judging whether the three-dimensional region corresponding to the node to be processed is completely located in the visualization region, when the three-dimensional region corresponding to the node to be processed is completely located in the visualization region, the local model included in the node to be processed is determined as the target local model, so that the accuracy and efficiency of the target local model are improved.
In a second aspect, the present disclosure provides a model display apparatus comprising: a Central Processing Unit (CPU) and a Graphic Processing Unit (GPU);
the CPU is used for storing octree information corresponding to each three-dimensional model included in a target scene, and transmitting model information of a target local model included by at least one node to the GPU after determining the target local model included by the node; wherein the target local model included in the at least one node is determined by using the model display method of the first aspect or any implementation method;
the GPU is used for storing the received model information of the target local model included by the node into an internal memory; and rendering and displaying the target local model in a shooting picture of a virtual camera by reading the model information in the internal memory.
Here, by using the model display method according to the first aspect or any one of the embodiments, after the target local model is determined more accurately, the model information of the target local model may be sent to the GPU without sending model information of other local models to the GPU, so that the amount of information transmission is reduced, consumption of bandwidth resources caused when sending model information of other local models that do not need rendering to the GPU is alleviated, and the utilization rate of the bandwidth resources is improved. Meanwhile, the model information of the target local model is loaded to an internal memory (internal memory), and the model information of other local models is not required to be loaded to the internal memory, so that the expenditure of the internal memory is reduced, and the utilization rate of the internal memory is improved.
In a possible implementation manner, the CPU is further configured to send, after the target local model is updated, the updated model information of the target local model to the GPU;
the GPU is also used for deleting the model information which is not matched with the updated target local model in the internal memory; and storing the model information of the target local model which is not stored in the updated target local model into the internal memory.
In the foregoing embodiment, after the target local model is updated, the updated model information of the target local model may be loaded into the memory, and the model information in the memory that is not matched with the updated target local model is deleted, so as to ensure that the model information of the target local model that needs to be rendered and displayed currently is loaded in the memory, and avoid waste of memory resources.
The following descriptions of the effects of the apparatus, the electronic device, and the like refer to the description of the above method, and are not repeated here.
In a third aspect, the present disclosure provides a model display apparatus, comprising:
the acquisition module is used for acquiring octree information corresponding to each three-dimensional model in a target scene; wherein the octree information comprises a plurality of nodes; each three-dimensional region characterized by a node comprises a local model on the three-dimensional model; the fineness of a local model included by the node is positively correlated with the node depth of the node; the local model with high fineness comprises the number of vertexes, and the number of vertexes is larger than that of the local model with low fineness;
the first determination module is used for determining the area information of a visual area of a virtual camera based on the current shooting parameter information of the virtual camera used for shooting the three-dimensional model in the target scene;
and the second determining module is used for determining a target local model included in at least one node located in the visualization region based on the octree information and the region information respectively corresponding to each three-dimensional model included in the target scene.
In a fourth aspect, the present disclosure provides an electronic device comprising: a processor, a memory and a bus, the memory storing machine-readable instructions executable by the processor, the processor and the memory communicating via the bus when the electronic device is running, the machine-readable instructions when executed by the processor performing the steps of the model exhibition method according to the first aspect or any one of the embodiments.
In a fifth aspect, the present disclosure provides a computer-readable storage medium having stored thereon a computer program which, when executed by a processor, performs the steps of the model exhibition method according to the first aspect or any one of the embodiments described above.
In order to make the aforementioned objects, features and advantages of the present disclosure more comprehensible, preferred embodiments accompanied with figures are described in detail below.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present disclosure, the drawings needed to be used in the embodiments will be briefly described below.
FIG. 1 is a flow chart diagram illustrating a model display method provided by an embodiment of the present disclosure;
fig. 2 is a schematic diagram illustrating a three-dimensional region, a sub three-dimensional region and an octree corresponding to a target model in a model display method provided by an embodiment of the present disclosure;
FIG. 3 is a schematic diagram illustrating an original local model in a model exhibition method provided by an embodiment of the disclosure;
FIG. 4 is a schematic diagram illustrating a sub three-dimensional region and a visualization region in a model display method provided by an embodiment of the disclosure;
FIG. 5 is a schematic diagram illustrating another seed three-dimensional region and a visualization region in the model display method provided by the embodiment of the disclosure;
FIG. 6 is a schematic diagram illustrating another seed three-dimensional region and a visualization region in the model display method provided by the embodiment of the disclosure;
fig. 7 shows an architecture diagram of a model exhibition device provided by an embodiment of the present disclosure.
Fig. 8 shows an architecture diagram of a model exhibition apparatus provided by an embodiment of the present disclosure.
Fig. 9 shows a schematic structural diagram of an electronic device provided in an embodiment of the present disclosure.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present disclosure more clear, the technical solutions of the embodiments of the present disclosure will be described below in detail and completely with reference to the accompanying drawings in the embodiments of the present disclosure.
For each three-dimensional model, a model file corresponding to the three-dimensional model can be generated by using a three-dimensional reconstruction algorithm, the data capacity of the model file of the three-dimensional model generated by the three-dimensional reconstruction algorithm is large, and if more three-dimensional models need to be rendered in a scene and the memory capacity of equipment for rendering and displaying is small, the model file of each three-dimensional model is loaded into a memory, so that the equipment with small memory capacity cannot render and display each three-dimensional model, and inconvenience is brought to the rendering and displaying of each three-dimensional model.
Generally, for each three-dimensional model, models with various accuracies can be constructed, such as a high-accuracy model, a medium-accuracy model, a low-accuracy model, and the like; for the same model, the higher the precision of the model is, the more triangular patches are required for constructing the three-dimensional model. Furthermore, three-dimensional models with different accuracies can be selected for rendering according to the distance between the three-dimensional model and a virtual camera used for shooting the three-dimensional model. For example, when the three-dimensional model is far away, the three-dimensional model with low precision can be selected for rendering and displaying, and when the three-dimensional model is near, the three-dimensional model with high precision can be selected for rendering and displaying. However, rendering and displaying are performed by constructing three-dimensional models with various accuracies, so that the construction of the three-dimensional models is complicated, and when the three-dimensional models are rendered and displayed, model files of the three-dimensional models with various accuracies need to be loaded into a memory, which increases memory overhead.
In order to alleviate the above problem, embodiments of the present disclosure provide a model display method, device, apparatus, electronic device, and storage medium.
It should be noted that: like reference numbers and letters refer to like items in the following figures, and thus, once an item is defined in one figure, it need not be further defined and explained in subsequent figures.
For the convenience of understanding the embodiments of the present disclosure, a model display method disclosed in the embodiments of the present disclosure will be described in detail first. An execution subject of the model display method provided by the embodiment of the present disclosure is generally a computer device with certain computing capability, and the computer device includes: a terminal device or a server; the server may be, for example, a local server, a cloud server, or the like. The terminal device may be, for example, a mobile phone, a tablet, Augmented Reality (AR) glasses, a Personal Digital Assistant (PDA), or the like. In some possible implementations, the model demonstration method may be implemented by way of a processor calling computer readable instructions stored in a memory.
Referring to fig. 1, a schematic flow chart of a model displaying method provided in the embodiment of the present disclosure is shown, where the method includes: S101-S103, wherein:
s101, acquiring octree information corresponding to each three-dimensional model in a target scene; wherein the octree information comprises a plurality of nodes; the three-dimensional region represented by each node comprises a local model on the three-dimensional model; the fineness of the local model included by the node is positively correlated with the node depth of the node; the number of vertexes included in the local model with high fineness is greater than that of the vertexes included in the local model with low fineness;
s102, determining area information of a visual area of a virtual camera based on current shooting parameter information of the virtual camera for shooting a three-dimensional model in a target scene;
s103, determining a target local model included by at least one node in the visual region based on the octree information and the region information respectively corresponding to each three-dimensional model included in the target scene.
In the method, octree information corresponding to each three-dimensional model in a target scene is acquired; the octree information comprises a plurality of nodes, and a three-dimensional region represented by each node comprises a local model on a three-dimensional model; that is, the three-dimensional model is divided into a plurality of local models, and each local model corresponds to one node in the octree. After the area information of the visual area of the virtual camera is determined based on the current shooting parameter information of the virtual camera, the target local model in the visual area can be determined more efficiently and accurately based on the area information of the current visual area of the virtual camera and the octree information of each three-dimensional model, the refined rendering display of each three-dimensional model is realized, and the display flexibility of the three-dimensional model is improved.
S101 to S103 will be specifically described below.
For S101:
the three-dimensional model may include a model corresponding to real objects in the target scene. For example, the target scene may be a school scene, a market scene, an office scene, and the like, and the three-dimensional model may include a teaching building included in the school scene, and models of real objects such as desks and chairs in the teaching building. Alternatively, the three-dimensional model may also include constructed virtual objects, e.g., the three-dimensional model may include constructed virtual instructors, virtual animals, etc.
The octree information corresponding to each three-dimensional model comprises a plurality of nodes, each node corresponds to a three-dimensional area, and the three-dimensional area comprises a local model on the three-dimensional model. The node depth is larger, and the fineness of the local model included in the three-dimensional region represented by the node is higher. Aiming at the same local model, the number of vertexes included in the local model with high fineness degree is greater than that included in the local model with low fineness degree; that is, the local model with high fineness includes a triangular patch, and the triangular patch is larger than the local model with low fineness, and the triangular patch is composed of a plurality of vertexes and a connection relation between the vertexes.
In implementation, a three-dimensional reconstruction algorithm may be used to generate a model file corresponding to each three-dimensional model in the target scene, and the three-dimensional model may be a high-precision model. After each three-dimensional model in the target scene is constructed, octree information corresponding to each three-dimensional model can be determined for each three-dimensional model. And then octree information corresponding to each three-dimensional model can be obtained.
In one possible implementation, obtaining octree information corresponding to each three-dimensional model included in the target scene may include:
step A1, obtaining model information of each three-dimensional model included in the target scene;
step a2, generating octree information corresponding to the three-dimensional models based on the model information corresponding to each three-dimensional model.
In general, the three-dimensional model may include: a plurality of grids; wherein any one of the meshes has a common vertex with at least one other mesh. The grids are connected with each other to form a three-dimensional model. Wherein each mesh is a triangular patch.
In implementation, the model information of each three-dimensional model included in the target scene may be obtained first, where the model information includes vertex coordinates of a plurality of vertices and connection side information between the vertices.
And generating octree information corresponding to the three-dimensional model based on the model information corresponding to the three-dimensional model for each three-model. For example, the three-dimensional model may be used as a target model, and the target model is divided into eight local models according to the set segmentation direction based on the model information of the target model, so as to obtain the model information of each local model; and then taking each local model as a target model, returning to the step of dividing the target model into eight local models according to the set segmentation direction until the division times are equal to the set time threshold value, and/or until the volume of the divided local models is less than or equal to the set volume threshold value, and the like. And generating octree information corresponding to the three-dimensional model according to the model information of each local model obtained after division. Or, performing vertex deletion processing on at least one local model obtained after division to obtain model information of the local model after deletion processing; and generating octree information corresponding to the three-dimensional model according to the model information of the local model after deletion processing and/or the model information of the local model without the deleted vertex.
By using the acquired model information of each three-dimensional model in the target scene, octree information corresponding to the three-dimensional model can be generated accurately, data support is provided for subsequent determination of the target local model, and refined display of each three-dimensional model in the target scene is realized.
In one possible implementation, in step a2, generating octree information corresponding to three-dimensional models based on model information corresponding to each three-dimensional model may include:
step a21, based on the model information corresponding to each three-dimensional model, generates initial octree information corresponding to the three-dimensional model. The three-dimensional region represented by each node in the initial octree information comprises an original local model corresponding to the three-dimensional model; the original local model comprises a plurality of vertexes and a plurality of meshes formed by connection relations among the vertexes.
Step A22, determining a vertex to be deleted in the original local model corresponding to the node for each node in the initial octree information, and generating a local model corresponding to the node based on other vertices except the vertex to be deleted in a plurality of vertices included in the original local model.
Step A23, generating octree information corresponding to the three-dimensional model based on the local model information of the local model corresponding to each node.
In the embodiment of the disclosure, for each node in the generated initial octree information, a vertex to be deleted in the original local model corresponding to the node is determined, and a local model corresponding to the node is generated based on other vertexes, except the vertex to be deleted, in the multiple vertexes included in the original local model, wherein the model precision of the local model after the vertex deletion is lower than that of the original local model not deleted, so that the model precision of the model corresponding to the node is reduced, and then, based on the local model information of the local model corresponding to each node, octree information corresponding to the three-dimensional model can be generated more accurately, so that the octree information corresponding to the three-dimensional model can be utilized later to more accurately determine a target local model located in a visualization area, and fine display of the three-dimensional model is realized.
In step a21, after model information of a three-dimensional model is obtained, initial octree information corresponding to the three-dimensional model may be generated based on the model information corresponding to the three-dimensional model; the initial octree information comprises a plurality of nodes, the three-dimensional region represented by each node comprises an original local model corresponding to the three-dimensional model, and the original local model is a model with undeleted vertexes. Namely, the model precision of the original local model corresponding to each node in the initial octree information is the same.
For example, the three-dimensional model may be divided according to the set segmentation direction to obtain a plurality of original local models and model information of the original local models. And generating octree information corresponding to the three-dimensional model according to the model information of the original local models.
In one possible embodiment, in step a21, generating initial octree information corresponding to three-dimensional models based on model information corresponding to each three-dimensional model includes:
and step A211, taking the three-dimensional model as a target model, and dividing the three-dimensional area corresponding to the target model into eight sub three-dimensional areas according to a set dividing mode based on the model information of the target model.
The node information of the root node comprises model information of the three-dimensional model; each sub three-dimensional area corresponds to one sub node; the node information of each child node includes: model information or preset information of the original local model located in the sub-three-dimensional region corresponding to the node.
Step A212, when the child nodes meeting the preset conditions exist, the original local models included in the child nodes meeting the preset conditions are used as target models, model information based on the target models is returned, and the three-dimensional areas corresponding to the target models are divided into eight sub three-dimensional areas according to the set dividing mode until the divided child nodes do not meet the preset conditions.
Wherein, the child node satisfying the preset condition includes: and/or the node information comprises child nodes of which the number of vertexes in the model information is greater than the set number threshold.
Step a213 generates initial octree information corresponding to the three-dimensional model based on the generated node information of the root node and the node information of each child node.
And taking the three-dimensional model as a target model, and dividing the three-dimensional area corresponding to the target model into eight sub three-dimensional areas according to a set dividing mode based on the model information of the target model. The three-dimensional region corresponding to the target model may be a three-dimensional region in which a three-dimensional detection frame surrounding the target model is located. Alternatively, the three-dimensional region corresponding to the target model may also be a three-dimensional region in which the contour of the target model is located.
The dividing manner may include a plurality of cutting directions, for example, a horizontal direction, a vertical direction and a vertical direction, and any two directions of the horizontal direction, the vertical direction and the vertical direction are perpendicular to each other. Wherein the cutting direction can be set as shown in fig. 2.
Referring to fig. 2, taking the three-dimensional model as the target model, the three-dimensional region corresponding to the target model (i.e. the three-dimensional region where the three-dimensional detection frame of the target model is located) is divided into 8 sub three-dimensional regions along the plurality of cutting directions indicated by the dividing manner. The node corresponding to the three-dimensional region of the three-dimensional model is taken as a root node, and the node information of the root node includes model information of the three-dimensional model, that is, a node 1 in the octree on the right side in fig. 2 is taken as the root node. Each sub three-dimensional area corresponds to one sub node, namely the sub node 2, the sub node 3, the sub node … … and the sub node 9; the node information of each child node includes: model information or preset information of the original local model located in the sub-three-dimensional region corresponding to the node. When the original local model does not exist in the sub three-dimensional region corresponding to the node, the node information of the node may be set as preset information, and the preset information may be, for example, 0.
And after obtaining a plurality of child nodes, judging whether the child nodes meet preset conditions or not for each child node, if so, taking an original local model included in the child node as a target model, returning to model information based on the target model, and dividing a three-dimensional region corresponding to the target model into eight sub three-dimensional regions according to a set dividing mode. For example, if it is determined that the child node 4 in fig. 2 satisfies the preset condition, the original local model included in the child node 4 is taken as the target model, and the process returns to step a 211. If it is determined that the child node 2 in fig. 2 does not satisfy the preset condition, the subsequent processing is not performed, that is, the child node 2 does not need to perform the splitting processing.
The preset condition may include that the node depth is less than a set depth threshold, and/or the number of vertices in the model information included in the node information is greater than a set number threshold. For example, the node depth of the child node is less than the set depth threshold, and/or the node information of the child node includes model information in which the number of vertices is greater than the set number threshold. The node depth of the child node is related to the number of layers of the child node in the octree, for example, as in fig. 2, the node depth of the root node 1 may be 0, the node depth of the child node 2 to the child node 9 may be 1, and the node depth of the child node 10 to the child node 25 may be 2.
The depth threshold and the number threshold may be set according to actual situations, for example, the depth threshold may be 4, 5, 6, etc., and the number threshold may be 5, 8, etc.
During implementation, if the node information of the child node includes preset information, it is determined that the child node does not satisfy the preset condition, and the child three-dimensional region corresponding to the child node is not divided. If the node information of the child node comprises model information of an original local model located in a child three-dimensional area corresponding to the child node, judging whether the child node meets a preset condition, and under the condition that the child node meets the preset condition, taking the original local model included in the child node as a target model, dividing the three-dimensional area corresponding to the target model until the obtained child nodes after division do not meet the preset condition, so that the node information of the root node, a plurality of child nodes and the node information of each child node are obtained.
And further generating initial octree information corresponding to the three-dimensional model based on the node information of the root node and the node information of each child node. See fig. 2 for the right hand side illustration of the octree, where each circle in the octree represents a node.
Here, by taking the three-dimensional model as a target model, the three-dimensional region corresponding to the target model is divided into eight sub three-dimensional regions according to the set division mode based on the model information of the target model; and setting a preset condition, dividing the child nodes when determining that the child nodes meeting the preset condition exist, and obtaining the node information of the root node and the node information of each child node until the child nodes obtained after division do not meet the preset condition. And then, based on the node information of the root node and the node information of each child node, the initial octree information corresponding to the three-dimensional model is generated more accurately.
In step a22, for each node in the initial octree information, a vertex to be deleted in the original local model corresponding to the node may be determined; for example, the vertex to be deleted may be determined from multiple vertices included in the original local model according to the normal similarity between any two meshes having the same vertex on the original local model.
And generating a local model corresponding to the node based on other vertexes except the vertex to be deleted in the plurality of vertexes included in the original local model. For example, a triangulation algorithm may be used to triangulate, to generate a new mesh, the vertices of the original local model except the vertex to be deleted; and obtaining a local model corresponding to the node according to the new mesh and other vertexes.
In implementation, the triangulation algorithm includes the following steps: step 1, calculating concave-convex vertexes of the simple polygon. Step 2, sorting the triangles according to the minimum value of the internal angles and removing the largest constructed triangular meshes; modifying a vertex chain table of the polygon to recalculate the concavity and convexity of the polygon; this process is repeated until the boundary vertex linked list is empty. And 3, obtaining the Delaunay triangulation network according to the maximum-minimum criterion in the local range, namely obtaining at least one mesh formed by other vertexes except the vertex to be deleted.
In one possible implementation, in step a22, determining vertices to be deleted in the original local model corresponding to the node includes:
step a221, based on the model information of the original local model included in the node, determining normal similarity between normals respectively corresponding to the multiple meshes indicated by the model information.
Step A222, determining vertexes to be deleted in the original local model corresponding to the nodes based on the normal similarity between the normals respectively corresponding to the multiple grids.
In implementation, for each node in the initial octree information, based on model information of an original local model included in the node, determining a plurality of grids included in the original local model, and determining a normal of a surface corresponding to each grid; for example, a normal vector of a surface corresponding to the mesh may be determined from coordinate information of three vertices constituting the mesh, and the normal vector may be used as a normal line corresponding to the mesh. And then determining the normal similarity between the normals of two grids with the same vertex in the plurality of grids included by the original local model. For example, the distance between the normals can be determined from the normal vectors of the two grids; and determines the distance as the normal similarity between the normals of the two grids.
And determining a vertex to be deleted in the original local model corresponding to the node based on the normal similarity between the normals respectively corresponding to the networks. For example, the normal similarity between the normals corresponding to two meshes having a common vertex may be compared with the normal similarity threshold corresponding to the node, and if the normal similarity between the normals corresponding to the two meshes is greater than the normal similarity threshold corresponding to the node, the vertex shared between the two meshes is used as the vertex to be deleted. The normal similarity threshold corresponding to the node may be set according to an actual situation.
Here, the normal similarity between the normals respectively corresponding to the multiple meshes indicated by the model information is determined based on the model information of the original local model corresponding to the node; determining a vertex to be deleted from a plurality of vertexes of the original local model more conveniently based on the normal similarity between the normals respectively corresponding to the grids; and then, based on other vertexes except the vertex to be deleted in the multiple vertexes, generating a local model corresponding to the node, simplifying the original local model, and improving the efficiency of simplifying the three-dimensional model.
In one possible implementation manner, in step a222, determining vertices to be deleted in the original local model corresponding to the nodes based on the normal similarity between the normals corresponding to the multiple meshes respectively includes:
step one, traversing each vertex of the original local model, and determining a target mesh comprising the traversed vertex aiming at the traversed vertex.
Comparing the normal similarity between the normals corresponding to the target grid with a normal similarity threshold corresponding to the node; and the normal similarity threshold corresponding to the node is positively correlated with the node depth corresponding to the node.
And step three, determining the traversed vertex as a vertex to be deleted in response to the fact that the normal similarity is larger than or equal to the normal similarity threshold.
In implementation, the vertices to be traversed may be all vertices in the original local model or may be part of vertices. For example, only a certain side of the original local model representation is simplified, and the vertex in the side is taken as the vertex to be traversed. When traversing each vertex of the original local model, a target mesh corresponding to the vertex can be determined according to the position of the traversed vertex, that is, a target mesh including the vertex is determined.
In the example of the original local model shown in fig. 3, the original local model includes 14 vertices, i.e., vertices traversed by a 1-a 14, and further includes a mesh of connection relationships between a 1-a 14.
Assuming that the currently traversed vertex is a4, it can be determined that all vertices having a connection relationship with a4 include: a1, a2, a3, a5, a6, the corresponding target grid includes: (a4, a1, a2), (a4, a2, a6), (a4, a6, a5), (a4, a5, a3), (a4, a3, a 1).
Assuming that the currently traversed vertex is a9, the vertex having an association relationship with a9 can be determined to include: a5, a10, a13, a8, the corresponding target mesh comprising: m1(a9, a5, a10), M2(a9, a10, a13), M3(a9, a13, a8), M4(a9, a8, a 5).
After the target mesh is determined, the normal similarity between the corresponding normals of the target mesh may be determined by calculating the distance between the normal vectors, where the distance includes: at least one of Euclidean distance, Manhattan distance, cosine of included angle, Hamming distance, Chebyshev distance and the like can be determined according to actual conditions.
After the normal similarity of the normals between the target grids is determined, the normal similarity between the normals corresponding to the target grids can be compared with the normal similarity threshold corresponding to the node; and determining the traversed vertex as the vertex to be deleted in response to the normal similarity being larger than or equal to the normal similarity threshold. And the normal similarity threshold corresponding to the node is positively correlated with the node depth corresponding to the node. That is, the greater the node depth corresponding to the node is, the greater the normal similarity threshold corresponding to the node is.
Generally, for the same three-dimensional model, the larger the normal similarity threshold is, the smaller the number of determined vertexes to be deleted on the three-dimensional model is, the smaller the simplification of the three-dimensional model is, and the higher the precision of the simplified three-dimensional model is; conversely, the smaller the normal similarity threshold is, the greater the number of determined vertices to be deleted on the three-dimensional model is, the greater the simplification of the three-dimensional model is, and the lower the precision of the simplified three-dimensional model is. By setting different normal similarity thresholds for nodes with different node depths, the precision of original local models corresponding to the nodes with different node depths is different, and the refined display of each three-dimensional model in a target scene is realized.
For example, when the three-dimensional model is closer to the virtual camera, the target local model corresponding to the node with the larger node depth on the three-dimensional model is determined to be displayed, and the precision of the target local model is higher, that is, the target local model with higher precision is displayed under the condition; when the three-dimensional model is far away from the virtual camera, the target local model corresponding to the node with the smaller node depth on the three-dimensional model is determined to be displayed, the precision of the target local model is lower, namely the target local model with the lower precision is displayed under the condition, and the refined display of the three-dimensional model is realized.
For example, in fig. 2, if the depth of the node 1 is 0, the normal similarity threshold corresponding to the node 1 may be, for example, 0.6; the depths from the node 2 to the node 9 are all 1, and then the corresponding normal similarity thresholds from the node 2 to the node 9 are the same, for example, may be 0.8; if the depths from the node 10 to the node 25 are all 2, the corresponding normal similarity thresholds from the node 10 to the node 25 are the same, for example, may be 0.9.
Illustratively, continuing with fig. 3, if the currently traversed vertex is a9, and the target network corresponding to the vertex a9 includes M1, M2, M3, and M4, then M1 and M2, M1 and M3, M1 and M4, M2 and M3, M2 and M4, M3 and M4, and 6 target mesh pairs respectively correspond to normal similarities, if the normal similarities corresponding to M1 and M2, M1 and M3, M1 and M4, M2 and M3, M2 and M4, and M3 and M4 are all greater than or equal to the normal similarity threshold corresponding to the node, then tokens M1, M2, M3 and M4 can be merged into the same plane, and also will not cause an influence on the structure characterized by the target local model outside the acceptance range, and therefore the vertex a9 to be deleted.
If the normal similarity corresponding to any target mesh pair in the 6 target mesh pairs is smaller than the normal similarity threshold corresponding to the node, the characterization will have a large influence on the structure characterized by the three-dimensional model if a9 is deleted and M1, M2, M3 and M4 are merged into the same plane, so that the vertex a9 cannot be deleted, that is, the vertex a9 cannot be used as the vertex to be deleted.
And traversing all the vertexes in the original local model, and taking the vertexes which can be deleted from the original local model as vertexes to be deleted.
Therefore, the boundary of the top point deletion is limited through the normal similarity threshold with controllable numerical value, so that the simplification fineness of the original local model is controllable, the precision of the simplified local model is guaranteed, and the model simplification efficiency is improved.
In step a23, after obtaining the local model information of the local model corresponding to each node, octree information corresponding to the three-dimensional model may be generated from the local model information of the local model corresponding to each node.
For S102:
here, the virtual camera may be a virtual camera included in the rendering engine to photograph the three-dimensional model. The current photographing parameter information of the virtual camera may include a current pose of the virtual camera, a visible angle range of the virtual camera, a visible distance of the virtual camera, and the like. Wherein, the visual angle range and the visual distance can be set according to the actual situation. For example, the visual angle range may match the human eye visibility, the visual distance may be 50 meters, and the like.
During implementation, the current visual area corresponding to the virtual camera and the area information of the visual area under the current pose of the virtual camera can be determined according to the visual angle range of the virtual camera and the visual distance of the virtual camera.
For S103:
in implementation, a three-dimensional model in a target scene, which is located in a visualization area, may be determined based on area information of the visualization area of the virtual camera; and determining a target local model included by at least one node in the visualization area based on the octree information corresponding to the three-dimensional model in the visualization area. For example, the three-dimensional region represented by each node included in the octree information may be compared with the visualization region to determine a target local model included in at least one node located in the visualization region.
In a possible implementation manner, determining a target local model included in at least one node located in a visualization region based on octree information and region information respectively corresponding to three-dimensional models included in a target scene includes:
and step B1, determining at least one target three-dimensional model in the visual region based on the region information, the display pose of each three-dimensional model included in the target scene and the model size.
And step B2, determining a target local model included by at least one node in the visualization area based on the octree information corresponding to the target three-dimensional model and the area information.
In implementation, at least one target three-dimensional model located in the visualization area is determined based on the area information, the display pose of each three-dimensional model included in the target scene, and the model size. For example, the spatial region of each three-dimensional model in the target scene can be determined according to the display pose and the model size of the three-dimensional model; judging whether a space region corresponding to the three-dimensional model is overlapped with the visual region or not, if so, determining that the three-dimensional model belongs to a target three-dimensional model; and if not, the three-dimensional model does not belong to the target three-dimensional model.
And determining a target local model included by at least one node in the visual region based on the octree information and the region information corresponding to the target three-dimensional model. For example, a three-dimensional region represented by each node included in the octree information may be compared with the current visualization region, and according to a comparison result, a target local model included in at least one node located in the current visualization region is determined. For example, if the comparison result indicates that the current visualization area completely surrounds the three-dimensional area of the node, the local model included in the node belongs to the target local model.
In the embodiment of the disclosure, at least one target three-dimensional model located in a visual area is determined based on the area information, the display pose of each three-dimensional model included in the target scene and the model size; and then, according to the octree information and the region information corresponding to the target three-dimensional model, the target local model included by at least one node in the visual region is accurately determined, and the determination process of the target local model is simple and convenient and has high efficiency.
In a possible implementation, in step B2, determining a target local model included in at least one node in the visualization area based on the octree information and the area information corresponding to the target three-dimensional model, includes:
step B21, taking a root node in the octree information corresponding to the target three-dimensional model as a node to be processed, and determining whether a three-dimensional region corresponding to the node to be processed is completely located in a visual region indicated by the region information;
step B22, under the condition that the three-dimensional region corresponding to the node to be processed is partially located in the visualization region, taking each child node connected with the node to be processed as the node to be processed, and returning to the step of determining whether the three-dimensional region corresponding to the node to be processed is completely located in the visualization region indicated by the region information until the three-dimensional region corresponding to the node to be processed is completely located in the visualization region;
and step B23, determining the local model included by the node to be processed as the target local model included by the node in the visualization area under the condition that the three-dimensional area corresponding to the node to be processed is completely located in the visualization area.
And taking a root node in the octree information corresponding to the target three-dimensional model as a node to be processed, and determining whether a three-dimensional region corresponding to the node to be processed is completely located in a visual region indicated by the region information. If the three-dimensional region part corresponding to the node to be processed is located in the visualization region, executing step B22; if the three-dimensional region corresponding to the node to be processed is completely located in the visualization region, executing step B23; and if the three-dimensional region corresponding to the node to be processed is not located in the visual region at all, determining that the local model included by the node to be processed does not belong to the target local model.
In implementation, traversal is started from a root node in octree information corresponding to a target three-dimensional model, and if a three-dimensional region part corresponding to the root node is located in a visual region, child nodes connected with the root node are traversed, namely, each child node connected with the root node is used as a node to be processed, and whether the three-dimensional region corresponding to the node to be processed is completely located in the visual region is determined.
And when the three-dimensional region corresponding to the node to be processed is partially located in the visual region, taking each sub-node connected with the node to be processed as the node to be processed, and returning to the step of determining whether the three-dimensional region corresponding to the node to be processed is completely located in the visual region indicated by the region information until the three-dimensional region corresponding to the node to be processed is completely located in the visual region. Referring to fig. 4, a schematic diagram of a three-dimensional region part corresponding to a node to be processed in a visualization region is shown.
And under the condition that the three-dimensional region corresponding to the node to be processed is completely positioned in the visual region, determining the local model included by the node to be processed as a target local model. Referring to fig. 5, the three-dimensional region corresponding to the node to be processed is completely located in the visualization region.
And under the condition that the three-dimensional region corresponding to the node is not located in the visual region at all, determining that the local model included by the node does not belong to the target local model, and not performing rendering display. Referring to fig. 6, the three-dimensional region corresponding to the node is not located in the visualization region at all.
In the above manner, by judging whether the three-dimensional region corresponding to the node to be processed is completely located in the visualization region, when the three-dimensional region corresponding to the node to be processed is completely located in the visualization region, the local model included in the node to be processed is determined as the target local model, so that the accuracy and efficiency of the target local model are improved.
It will be understood by those skilled in the art that in the method of the present invention, the order of writing the steps does not imply a strict order of execution and any limitations on the implementation, and the specific order of execution of the steps should be determined by their function and possible inherent logic.
Based on the same concept, an embodiment of the present disclosure further provides a model display device, as shown in fig. 7, which is an architecture schematic diagram of the model display device provided in the embodiment of the present disclosure, and includes a Central Processing Unit (CPU) 701 and a Graphics Processing Unit (GPU) 702, specifically:
the CPU701 is configured to store octree information corresponding to each three-dimensional model included in a target scene, and after determining a target local model included in at least one node, transmit model information of the target local model included in the node to the GPU; the target local model included in the at least one node is determined by using the model display method according to the above embodiment.
The GPU702 is configured to store the received model information of the target local model included in the node into an internal memory; and rendering and displaying the target local model in a shooting picture of a virtual camera by reading the model information in the internal memory.
During implementation, after each three-dimensional model is constructed, octree information corresponding to each three-dimensional model is determined according to model information of each three-dimensional model in a target scene; and storing the octree information corresponding to each three-dimensional model into the CPU. And determining the target local model to be rendered and displayed according to the embodiment. And transmitting the model information of the target local model to the connected GPU. For the determination process of the target local model, reference may be made to the above detailed description of S101 to S103, which is not repeated herein.
And the GPU stores the received model information of the target local model into an internal memory (internal memory), and renders and displays the target local model in a shooting picture of the virtual camera by reading the model information in the internal memory.
Here, by using the model display method according to the first aspect or any one of the embodiments, after the target local model is determined more accurately, the model information of the target local model may be sent to the GPU without sending model information of other local models to the GPU, so that the amount of information transmission is reduced, consumption of bandwidth resources caused when sending model information of other local models that do not need rendering to the GPU is alleviated, and the utilization rate of the bandwidth resources is improved. Meanwhile, the model information of the target local model is loaded to an internal memory (internal memory), and the model information of other local models is not required to be loaded to the internal memory, so that the expenditure of the internal memory is reduced, and the utilization rate of the internal memory is improved.
In an optional embodiment, the CPU is further configured to, after the target local model is updated, send the updated model information of the target local model to the GPU;
the GPU is also used for deleting the model information which is not matched with the updated target local model in the internal memory; and storing the model information of the target local model which is not stored in the updated target local model into the internal memory.
When the current pose of the virtual camera is changed, the current shooting parameter information of the virtual camera is changed, the visual area corresponding to the virtual camera is changed, and therefore the determined target local model is changed. The target local model may be re-determined using the process of S101-S03 described above.
After determining the updated target partial model from each three-dimensional model in the target scene area based on the octree information and the updated current shooting parameter information corresponding to the virtual camera, the CPU may send the model information of the updated target partial model to the GPU. The GPU can delete the model information which is not matched with the updated target local model in the memory; and storing the model information of the target local model which is not stored in the updated target local model into a memory, so that the model information of the target local model which needs to be rendered and displayed is stored in the memory, the consumption of memory resources is relieved, and the utilization rate of the memory resources is improved.
In the foregoing embodiment, after the target local model is updated, the updated model information of the target local model may be loaded into the memory, and the model information in the memory that is not matched with the updated target local model is deleted, so as to ensure that the model information of the target local model that needs to be rendered and displayed currently is loaded in the memory, and avoid waste of memory resources.
Based on the same concept, an embodiment of the present disclosure further provides a model display apparatus, as shown in fig. 8, which is an architecture schematic diagram of the model display apparatus provided in the embodiment of the present disclosure, and includes an obtaining module 801, a first determining module 802, and a second determining module 803, specifically:
an obtaining module 801, configured to obtain octree information corresponding to each three-dimensional model included in a target scene; wherein the octree information comprises a plurality of nodes; each three-dimensional region characterized by a node comprises a local model on the three-dimensional model; the fineness of a local model included by the node is positively correlated with the node depth of the node; the local model with high fineness comprises the number of vertexes, and the number of vertexes is larger than that of the local model with low fineness;
a first determining module 802, configured to determine area information of a visualization area of a virtual camera used for shooting a three-dimensional model in the target scene based on current shooting parameter information of the virtual camera;
a second determining module 803, configured to determine, based on the octree information and the region information respectively corresponding to each three-dimensional model included in the target scene, a target local model included in at least one node located in the visualization region.
In a possible embodiment, the apparatus further comprises: a first generating module 804, where the first generating module 804 is configured to generate octree information corresponding to each three-dimensional model included in the target scene according to the following steps:
obtaining model information of each three-dimensional model included in a target scene;
and generating octree information corresponding to the three-dimensional models based on the model information corresponding to each three-dimensional model.
In one possible implementation, the first generating module 804, when generating octree information corresponding to the three-dimensional models based on the model information corresponding to each of the three-dimensional models, is configured to:
generating initial octree information corresponding to the three-dimensional models based on the model information corresponding to each three-dimensional model; wherein, the three-dimensional region represented by each node in the initial octree information comprises an original local model corresponding to the three-dimensional model; the original local model comprises a plurality of vertexes and a plurality of meshes formed by the connection relations among the vertexes;
determining a vertex to be deleted in an original local model corresponding to each node in the initial octree information, and generating a local model corresponding to the node based on other vertexes except the vertex to be deleted in a plurality of vertexes included in the original local model;
and generating octree information corresponding to the three-dimensional model based on the local model information of the local model corresponding to each node.
In a possible embodiment, the apparatus further comprises: a second generating module 805, configured to, when generating initial octree information corresponding to each three-dimensional model based on the model information corresponding to the three-dimensional model, generate:
taking the three-dimensional model as a target model, and dividing a three-dimensional area corresponding to the target model into eight sub three-dimensional areas according to a set dividing mode on the basis of model information of the target model; the node corresponding to the three-dimensional region of the three-dimensional model is a root node, and the node information of the root node comprises model information of the three-dimensional model; each sub three-dimensional area corresponds to one sub node; the node information of each child node includes: model information or preset information of an original local model located in the sub-three-dimensional region corresponding to the node;
when the sub-nodes meeting the preset conditions exist, the original local model included in the sub-nodes meeting the preset conditions is used as a target model, model information based on the target model is returned, and a three-dimensional area corresponding to the target model is divided into eight sub-three-dimensional areas according to a set dividing mode until the divided sub-nodes do not meet the preset conditions; wherein, the child node satisfying the preset condition includes: the node depth is smaller than the child nodes of the set depth threshold value, and/or the number of vertexes in the model information included in the node information is larger than the child nodes of the set number threshold value;
and generating initial octree information corresponding to the three-dimensional model based on the generated node information of the root node and the node information of each child node.
In a possible embodiment, the apparatus further comprises: a third determining module 806, where the third determining module 806 is configured to determine a vertex to be deleted in the original local model corresponding to the node:
determining normal similarity among normals respectively corresponding to a plurality of grids indicated by model information based on the model information of the original local model included by the node;
and determining the vertex to be deleted in the original local model corresponding to the node based on the normal similarity between the normals respectively corresponding to the grids.
In a possible implementation manner, the third determining module 806, when determining, based on the normal similarity between the normals corresponding to the multiple meshes, a vertex to be deleted in the original local model corresponding to the node, is configured to:
traversing each vertex of the original local model, and determining a target mesh comprising the traversed vertex aiming at the traversed vertex;
comparing the normal similarity between the normals corresponding to the target grid with a normal similarity threshold corresponding to the node; wherein the normal similarity threshold corresponding to the node is positively correlated with the node depth corresponding to the node;
and determining the traversed vertex as a vertex to be deleted in response to the normal similarity being greater than or equal to the normal similarity threshold.
In a possible implementation manner, the first determining module 802, when determining the target local model included in at least one node located in the visualization region based on the octree information and the region information respectively corresponding to the three-dimensional models included in the target scene, is configured to:
determining at least one target three-dimensional model located within the visualization area based on the area information, the display pose and the model size of each three-dimensional model included in the target scene;
and determining a target local model included by at least one node in the visualization region based on the octree information corresponding to the target three-dimensional model and the region information.
In a possible implementation manner, the second determining module 803, when determining the target local model included in at least one node in the visualization region based on the octree information corresponding to the target three-dimensional model and the region information, is configured to:
taking a root node in the octree information corresponding to the target three-dimensional model as a node to be processed, and determining whether a three-dimensional region corresponding to the node to be processed is completely located in a visual region indicated by the region information;
under the condition that the three-dimensional region corresponding to the node to be processed is partially located in the visualization region, taking each sub-node connected with the node to be processed as the node to be processed, and returning to the step of determining whether the three-dimensional region corresponding to the node to be processed is completely located in the visualization region indicated by the region information until the three-dimensional region corresponding to the node to be processed is completely located in the visualization region;
and under the condition that the three-dimensional region corresponding to the node to be processed is completely positioned in the visualization region, determining the local model included by the node to be processed as a target local model included by the node positioned in the visualization region.
In some embodiments, the functions of the apparatus provided in the embodiments of the present disclosure or the included templates may be used to execute the method described in the above method embodiments, and specific implementation thereof may refer to the description of the above method embodiments, and for brevity, no further description is provided here.
Based on the same technical concept, the embodiment of the disclosure also provides an electronic device. Referring to fig. 9, a schematic structural diagram of an electronic device provided in the embodiment of the present disclosure includes a processor 901, a memory 902, and a bus 903. The memory 902 is used for storing execution instructions, and includes a memory 9021 and an external memory 9022; the memory 9021 is also referred to as an internal memory, and is configured to temporarily store operation data in the processor 901 and data exchanged with an external memory 9022 such as a hard disk, the processor 901 exchanges data with the external memory 9022 through the memory 9021, and when the electronic device 900 is operated, the processor 901 communicates with the memory 902 through the bus 903, so that the processor 901 executes the following instructions:
acquiring octree information corresponding to each three-dimensional model included in a target scene; wherein the octree information comprises a plurality of nodes; each three-dimensional region characterized by a node comprises a local model on the three-dimensional model; the fineness of a local model included by the node is positively correlated with the node depth of the node; the local model with high fineness comprises the number of vertexes, and the number of vertexes is larger than that of the local model with low fineness;
determining area information of a visual area of a virtual camera based on current shooting parameter information of the virtual camera for shooting a three-dimensional model in the target scene;
and determining a target local model included in at least one node positioned in the visualization region based on the octree information and the region information respectively corresponding to each three-dimensional model included in the target scene.
The specific processing flow of the processor 901 may refer to the description of the above method embodiment, and is not described herein again.
In addition, the embodiment of the present disclosure further provides a computer-readable storage medium, where a computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the computer program performs the steps of the model displaying method described in the above method embodiment. The storage medium may be a volatile or non-volatile computer-readable storage medium.
The embodiments of the present disclosure also provide a computer program product, where the computer program product carries a program code, and instructions included in the program code may be used to execute the steps of the model displaying method in the foregoing method embodiments, which may be referred to specifically in the foregoing method embodiments, and are not described herein again.
The computer program product may be implemented by hardware, software or a combination thereof. In an alternative embodiment, the computer program product is embodied in a computer storage medium, and in another alternative embodiment, the computer program product is embodied in a Software product, such as a Software Development Kit (SDK), or the like.
The disclosure relates to the field of augmented reality, and aims to detect or identify relevant features, states and attributes of a target object by means of various visual correlation algorithms by acquiring image information of the target object in a real environment, so as to obtain an AR effect combining virtual and reality matched with specific applications. For example, the target object may relate to a face, a limb, a gesture, an action, etc. associated with a human body, or a marker, a marker associated with an object, or a sand table, a display area, a display item, etc. associated with a venue or a place. The vision-related algorithms may involve visual localization, SLAM, three-dimensional reconstruction, image registration, background segmentation, key point extraction and tracking of objects, pose or depth detection of objects, and the like. The specific application can not only relate to interactive scenes such as navigation, explanation, reconstruction, virtual effect superposition display and the like related to real scenes or articles, but also relate to special effect treatment related to people, such as interactive scenes such as makeup beautification, limb beautification, special effect display, virtual model display and the like. The detection or identification processing of the relevant characteristics, states and attributes of the target object can be realized through the convolutional neural network. The convolutional neural network is a network model obtained by performing model training based on a deep learning framework.
It is clear to those skilled in the art that, for convenience and brevity of description, the specific working processes of the system and the apparatus described above may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again. In the several embodiments provided in the present disclosure, it should be understood that the disclosed system, apparatus, and method may be implemented in other ways. The above-described embodiments of the apparatus are merely illustrative, and for example, the division of the units is only one logical division, and there may be other divisions when actually implemented, and for example, a plurality of units or components may be combined or integrated into another system, or some features may be omitted, or not executed. In addition, the shown or discussed mutual coupling or direct coupling or communication connection may be an indirect coupling or communication connection of devices or units through some communication interfaces, and may be in an electrical, mechanical or other form.
The units described as separate parts may or may not be physically separate, and parts displayed as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units can be selected according to actual needs to achieve the purpose of the solution of the embodiment.
In addition, functional units in the embodiments of the present disclosure may be integrated into one processing unit, or each unit may exist alone physically, or two or more units are integrated into one unit.
The functions, if implemented in the form of software functional units and sold or used as a stand-alone product, may be stored in a non-volatile computer-readable storage medium executable by a processor. Based on such understanding, the technical solution of the present disclosure may be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present disclosure. And the aforementioned storage medium includes: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk, or an optical disk.
The above are only specific embodiments of the present disclosure, but the scope of the present disclosure is not limited thereto, and any person skilled in the art can easily conceive of changes or substitutions within the technical scope of the present disclosure, and shall be covered by the scope of the present disclosure. Therefore, the protection scope of the present disclosure shall be subject to the protection scope of the claims.
Claims (13)
1. A method of model display, comprising:
acquiring octree information corresponding to each three-dimensional model included in a target scene; wherein the octree information comprises a plurality of nodes; each three-dimensional region characterized by a node comprises a local model on the three-dimensional model; the fineness of a local model included by the node is positively correlated with the node depth of the node; the local model with high fineness comprises the number of vertexes, and the number of vertexes is larger than that of the local model with low fineness;
determining area information of a visual area of a virtual camera based on current shooting parameter information of the virtual camera for shooting a three-dimensional model in the target scene;
and determining a target local model included in at least one node positioned in the visualization region based on the octree information and the region information respectively corresponding to each three-dimensional model included in the target scene.
2. The method according to claim 1, wherein the obtaining octree information corresponding to each three-dimensional model included in the target scene comprises:
obtaining model information of each three-dimensional model included in a target scene;
and generating octree information corresponding to the three-dimensional models based on the model information corresponding to each three-dimensional model.
3. The method of claim 2, wherein generating octree information corresponding to each of the three-dimensional models based on the model information corresponding to the three-dimensional model comprises:
generating initial octree information corresponding to the three-dimensional models based on the model information corresponding to each three-dimensional model; wherein, the three-dimensional region represented by each node in the initial octree information comprises an original local model corresponding to the three-dimensional model; the original local model comprises a plurality of vertexes and a plurality of meshes formed by the connection relations among the vertexes;
determining a vertex to be deleted in an original local model corresponding to each node in the initial octree information, and generating a local model corresponding to the node based on other vertexes except the vertex to be deleted in a plurality of vertexes included in the original local model;
and generating octree information corresponding to the three-dimensional model based on the local model information of the local model corresponding to each node.
4. The method of claim 3, wherein generating initial octree information corresponding to each of the three-dimensional models based on the model information corresponding to the three-dimensional model comprises:
taking the three-dimensional model as a target model, and dividing a three-dimensional area corresponding to the target model into eight sub three-dimensional areas according to a set dividing mode on the basis of model information of the target model; the node corresponding to the three-dimensional region of the three-dimensional model is a root node, and the node information of the root node comprises model information of the three-dimensional model; each sub three-dimensional area corresponds to one sub node; the node information of each child node includes: model information or preset information of the original local model located in the sub-three-dimensional region corresponding to the node;
when the child nodes meeting the preset conditions exist, the original local model included in the child nodes meeting the preset conditions is used as a target model, model information based on the target model is returned, and the three-dimensional region corresponding to the target model is divided into eight sub three-dimensional regions according to the set dividing mode until the divided child nodes do not meet the preset conditions; wherein, the child node satisfying the preset condition includes: the node depth is smaller than the child nodes of the set depth threshold value, and/or the number of vertexes in the model information included in the node information is larger than the child nodes of the set number threshold value;
and generating initial octree information corresponding to the three-dimensional model based on the generated node information of the root node and the node information of each child node.
5. The method according to claim 3 or 4, wherein the determining the vertex to be deleted in the original local model corresponding to the node comprises:
determining normal similarity between normals respectively corresponding to a plurality of grids indicated by the model information based on the model information of the original local model included by the node;
and determining the vertexes to be deleted in the original local model corresponding to the nodes based on the normal similarity among the normals respectively corresponding to the grids.
6. The method according to claim 5, wherein the determining vertices to be deleted in the original local model corresponding to the nodes based on the normal similarity between the normals corresponding to the meshes respectively comprises:
traversing each vertex of the original local model, and determining a target mesh comprising the traversed vertex aiming at the traversed vertex;
comparing the normal similarity between the normals corresponding to the target grid with a normal similarity threshold corresponding to the node; wherein the normal similarity threshold corresponding to the node is positively correlated with the node depth corresponding to the node;
and determining the traversed vertex as a vertex to be deleted in response to the normal similarity being greater than or equal to the normal similarity threshold.
7. The method according to any one of claims 1 to 6, wherein the determining a target local model included in at least one node located in the visualization region based on the octree information and the region information respectively corresponding to each three-dimensional model included in the target scene comprises:
determining at least one target three-dimensional model located within the visualization area based on the area information, the display pose and the model size of each three-dimensional model included in the target scene;
and determining a target local model included by at least one node in the visualization region based on the octree information corresponding to the target three-dimensional model and the region information.
8. The method according to claim 7, wherein the determining the target local model included in the at least one node in the visualization region based on the octree information corresponding to the target three-dimensional model and the region information comprises:
taking a root node in the octree information corresponding to the target three-dimensional model as a node to be processed, and determining whether a three-dimensional region corresponding to the node to be processed is completely located in a visual region indicated by the region information;
under the condition that the three-dimensional region corresponding to the node to be processed is partially located in the visualization region, taking each sub-node connected with the node to be processed as the node to be processed, and returning to the step of determining whether the three-dimensional region corresponding to the node to be processed is completely located in the visualization region indicated by the region information until the three-dimensional region corresponding to the node to be processed is completely located in the visualization region;
and under the condition that the three-dimensional region corresponding to the node to be processed is completely positioned in the visualization region, determining the local model included by the node to be processed as a target local model included by the node positioned in the visualization region.
9. A model display apparatus, comprising: a central processing unit CPU and a graphic processing unit GPU;
the CPU is used for storing octree information corresponding to each three-dimensional model included in a target scene, and transmitting model information of a target local model included by at least one node to the GPU after determining the target local model included by the node; wherein, the target local model included in the at least one node is determined by using the model display method of any one of claims 1 to 8;
the GPU is used for storing the received model information of the target local model included by the node into an internal memory; and rendering and displaying the target local model in a shooting picture of a virtual camera by reading the model information in the internal memory.
10. The apparatus of claim 9, wherein the CPU is further configured to send, after the target local model is updated, model information of the updated target local model to the GPU;
the GPU is also used for deleting the model information which is not matched with the updated target local model in the internal memory; and storing the model information of the target local model which is not stored in the updated target local model into the internal memory.
11. A model display apparatus, comprising:
the acquisition module is used for acquiring octree information corresponding to each three-dimensional model in a target scene; wherein the octree information comprises a plurality of nodes; each three-dimensional region characterized by a node comprises a local model on the three-dimensional model; the fineness of a local model included by the node is positively correlated with the node depth of the node; the local model with high fineness comprises the number of vertexes, and the number of vertexes is larger than that of the local model with low fineness;
the first determination module is used for determining the area information of a visual area of a virtual camera based on the current shooting parameter information of the virtual camera used for shooting the three-dimensional model in the target scene;
and the second determining module is used for determining a target local model included in at least one node located in the visualization region based on the octree information and the region information respectively corresponding to each three-dimensional model included in the target scene.
12. An electronic device, comprising: a processor, a memory and a bus, the memory storing machine-readable instructions executable by the processor, the processor and the memory communicating via the bus when the electronic device is running, the machine-readable instructions when executed by the processor performing the steps of the model exhibition method according to any one of claims 1 to 8.
13. A computer-readable storage medium, having stored thereon a computer program which, when being executed by a processor, carries out the steps of the model exhibition method according to one of the claims 1 to 8.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210153040.4A CN114529648A (en) | 2022-02-18 | 2022-02-18 | Model display method, device, apparatus, electronic device and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN202210153040.4A CN114529648A (en) | 2022-02-18 | 2022-02-18 | Model display method, device, apparatus, electronic device and storage medium |
Publications (1)
Publication Number | Publication Date |
---|---|
CN114529648A true CN114529648A (en) | 2022-05-24 |
Family
ID=81623706
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN202210153040.4A Pending CN114529648A (en) | 2022-02-18 | 2022-02-18 | Model display method, device, apparatus, electronic device and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN114529648A (en) |
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116049924A (en) * | 2023-03-07 | 2023-05-02 | 武汉益模科技股份有限公司 | Three-dimensional part difference analysis algorithm based on Cuda |
CN118379437A (en) * | 2024-06-21 | 2024-07-23 | 杭州群核信息技术有限公司 | Model processing method and device and electronic equipment |
-
2022
- 2022-02-18 CN CN202210153040.4A patent/CN114529648A/en active Pending
Cited By (2)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN116049924A (en) * | 2023-03-07 | 2023-05-02 | 武汉益模科技股份有限公司 | Three-dimensional part difference analysis algorithm based on Cuda |
CN118379437A (en) * | 2024-06-21 | 2024-07-23 | 杭州群核信息技术有限公司 | Model processing method and device and electronic equipment |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN110889890B (en) | Image processing method and device, processor, electronic equipment and storage medium | |
CN107223269A (en) | Three-dimensional scene positioning method and device | |
US11645815B2 (en) | Method, device, and storage medium for segmenting three-dimensional object | |
US20210225074A1 (en) | Multi-resolution voxel meshing | |
CN114529648A (en) | Model display method, device, apparatus, electronic device and storage medium | |
CN107464286B (en) | Method, device, equipment and readable medium for repairing holes in three-dimensional city model | |
CN115409933B (en) | Multi-style texture mapping generation method and device | |
WO2023024441A1 (en) | Model reconstruction method and related apparatus, and electronic device and storage medium | |
CN109979013B (en) | Three-dimensional face mapping method and terminal equipment | |
CN115439607A (en) | Three-dimensional reconstruction method and device, electronic equipment and storage medium | |
CN112102480B (en) | Image data processing method, apparatus, device and medium | |
CN111653175B (en) | Virtual sand table display method and device | |
CN111382618B (en) | Illumination detection method, device, equipment and storage medium for face image | |
CN112270709A (en) | Map construction method and device, computer readable storage medium and electronic device | |
CN116416366A (en) | 3D model construction method and device and electronic equipment | |
CN114742956B (en) | Model processing method, device, equipment and computer readable storage medium | |
CN117333637B (en) | Modeling and rendering method, device and equipment for three-dimensional scene | |
CN114529647A (en) | Object rendering method, device and apparatus, electronic device and storage medium | |
CN113313832A (en) | Semantic generation method and device of three-dimensional model, storage medium and electronic equipment | |
CN116385619A (en) | Object model rendering method, device, computer equipment and storage medium | |
CN113240789B (en) | Virtual object construction method and device | |
CN115761123B (en) | Three-dimensional model processing method, three-dimensional model processing device, electronic equipment and storage medium | |
CN116977539A (en) | Image processing method, apparatus, computer device, storage medium, and program product | |
TW202312100A (en) | Grid generation method, electronic device and computer-readable storage medium | |
CN116012666B (en) | Image generation, model training and information reconstruction methods and devices and electronic equipment |
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 |