Detailed Description
In the following description, for purposes of explanation and not limitation, specific details are set forth, such as particular system structures, techniques, etc. in order to provide a thorough understanding of the embodiments of the present application. It will be apparent, however, to one skilled in the art that the present application may be practiced in other embodiments that depart from these specific details. In other instances, detailed descriptions of well-known systems, devices, circuits, and methods are omitted so as not to obscure the description of the present application with unnecessary detail.
It will be understood that the terms "comprises" and/or "comprising," when used in this specification and the appended claims, specify the presence of stated features, integers, steps, operations, elements, and/or components, but do not preclude the presence or addition of one or more other features, integers, steps, operations, elements, components, and/or groups thereof.
It should also be understood that the term "and/or" as used in this specification and the appended claims refers to and includes any and all possible combinations of one or more of the associated listed items.
As used in this specification and the appended claims, the term "if" may be interpreted contextually as "when", "upon" or "in response to" determining "or" in response to detecting ". Similarly, the phrase "if it is determined" or "if a [ described condition or event ] is detected" may be interpreted contextually to mean "upon determining" or "in response to determining" or "upon detecting [ described condition or event ]" or "in response to detecting [ described condition or event ]".
Furthermore, in the description of the present application and the appended claims, the terms "first," "second," "third," and the like are used for distinguishing between descriptions and not necessarily for describing a relative importance or importance.
Reference throughout this specification to "one embodiment" or "some embodiments," or the like, means that a particular feature, structure, or characteristic described in connection with the embodiment is included in one or more embodiments of the present application. Thus, appearances of the phrases "in one embodiment," "in some embodiments," "in other embodiments," or the like, in various places throughout this specification are not necessarily all referring to the same embodiment, but rather "one or more but not all embodiments" unless specifically stated otherwise. The terms "comprising," "including," "having," and variations thereof mean "including, but not limited to," unless otherwise specifically stated.
It should be understood that, the sequence numbers of the steps in this embodiment do not mean the execution sequence, and the execution sequence of each process should be determined by its function and inherent logic, and should not constitute any limitation to the implementation process of this embodiment.
In the related technology, the detailed description of each level of detail model is not accurate enough, and the rendering effect is not ideal enough.
In view of this, embodiments of the present application provide a method and an apparatus for constructing a multi-level detail model, which determine a target texture resolution of each level first by presetting a texture resolution relationship, so as to express a degree of simplification of each level of detail model by a degree of simplification of texture information that has a relatively large influence on a rendering effect, so that the degree of simplification of each level of detail model is described more accurately, and the rendering effect is greatly improved.
The application scenario of the multilevel detail model construction method provided by the embodiment of the application is exemplified below, the application can be applied to all terminals with a three-dimensional model visualization function, the multilevel detail model construction of the three-dimensional model is performed on the terminals, and the multilevel detail model is constructed by performing targeted optimization on the geometric information and the texture information of the original three-dimensional model, so that the data volume required to be rendered is greatly reduced, and the three-dimensional rendering performance is further improved.
In order to explain the technical solution of the present application, the following description is given by way of specific examples.
Referring to fig. 1, a schematic flowchart of a method for constructing a multi-level detail model according to an embodiment of the present application is shown. As shown in fig. 1, the method for constructing a multi-level detail model may include the following steps:
step 101, determining the target texture resolution of each level according to the texture information of the original three-dimensional model and the preset texture resolution relationship between the detail models of each level.
In the embodiment of the application, an original three-dimensional model is read, texture information and geometric information of the original three-dimensional model are analyzed into corresponding data structures, the texture information is analyzed into a matrix which is in regular row-column sequencing according to the resolution, and elements in the matrix contain corresponding color information. The geometric information is analyzed as vertex data, edge composition index, and triangular face composition index.
The texture information is information for describing appearance characteristics of the three-dimensional model and consists of a series of pixels which are arranged in regular rows and columns according to the resolution; the geometric information is information describing morphological characteristics of the three-dimensional model and is composed of a series of geometric elements (points, edges and surfaces), wherein vertexes are taken as basic data and contain corresponding information such as three-dimensional coordinate positions, normals, tangents, UV coordinates, colors, bone weights and the like, the vertexes are connected with one another to form edges, the edges are connected with one another to form triangular surfaces, and then a triangular network describing morphological characteristics of the three-dimensional model is formed.
In the embodiment of the present application, after the texture information and the geometric information of the original three-dimensional model are analyzed, the texture information and the geometric information of the original three-dimensional model may be analyzed, including texture information analysis, geometric information analysis, and general information analysis. The texture information analysis may include the calculation of the following parameters: the number of textures, the resolution of each texture and the total number of pixels of the texture. The geometric information analysis may include the calculation of the following parameters: the total number of model vertexes, the total number of model triangular surfaces, the total area of the model triangular surfaces, a box surrounding the outside of the model and a sphere surrounding the outside of the model. The overall information analysis may include the calculation of the following parameters: the model UV total area represents the sum of triangular areas formed by UV coordinates corresponding to all triangular surface vertexes in the model and represents the total number of pixels corresponding to a model triangulation network; the texture pixel utilization rate is the ratio of the total area of the model UV to the total pixel number of the texture, namely the ratio of the effective pixel number to the total pixel number, and the smaller the value is, the more redundant the texture is; the texture resolution is effectively used as the power of 2 taken from the root of the square of the total UV area of the model, the minimum regularized texture resolution required by the number of effective pixels is expressed, and the minimum regularized texture resolution can be determined according to the actual data condition and the application requirement, and the method is not limited by the application; the geometric pixel ratio of the model is the root of the ratio of the total area of the triangular surface of the model to the total area of the UV of the model, namely the geometric length represented by one pixel in the texture of the model, and the larger the value is, the coarser the model is.
Further, in order to improve the efficiency of the geometric information and reduce the data redundancy, the geometric information of the original three-dimensional model may be optimized first, and then a subsequent simplification operation is performed, that is, in a possible implementation manner of the embodiment of the present application, before the step 101, the method may include:
carrying out geometric information optimization on the original three-dimensional model, wherein the geometric information optimization comprises the following steps: and removing repeated triangular surfaces in the geometric information of the original three-dimensional model, removing invisible triangular surfaces in the geometric information of the original three-dimensional model, and repairing wrong triangular surfaces.
In the embodiment of the application, since repeated, wrong or invisible situations may occur in all triangular surfaces of the original three-dimensional model, the repeated and invisible triangular surfaces need to be removed, and the wrong triangular surfaces need to be repaired.
As a possible implementation manner, the wrong triangular surface can be repaired by adjusting the vertex position.
Further, in order to improve the efficiency of texture information and reduce data redundancy, the texture information of the original three-dimensional model may be optimized first, and then a subsequent simplification operation is performed, that is, in a possible implementation manner of the embodiment of the present application, before the step 101, the method may include:
carrying out texture information optimization on the original three-dimensional model, wherein the texture information optimization comprises the following steps: and remapping the texture information corresponding to each triangular surface in the geometric information of the original three-dimensional model by taking the UV area corresponding to each triangular surface in the geometric information of the original three-dimensional model as a weight so as to adjust the texture resolution in the texture information of the original three-dimensional model to the most effectively utilized texture resolution.
As a possible implementation manner, firstly, the most effective utilization texture resolution obtained after analyzing the texture information and the geometric information of the original three-dimensional model is obtained, then, the optimized geometric data obtained after optimizing the geometric information of the original three-dimensional model is used as basic geometric data, texture remapping operation is performed on the three-dimensional model, and the mapping which most effectively utilizes the texture resolution is used as the optimized texture information data. In the texture remapping process, the UV area corresponding to each triangular surface in the geometric information in the original three-dimensional model is taken as the weight to map the new texture, so that the UV areas corresponding to the same triangular surfaces before and after mapping are kept unchanged, and the matching relation between the texture information and the geometric information is kept unchanged.
In the embodiment of the application, each level of target texture resolution refers to a target texture resolution corresponding to each level of detail model, that is, the original three-dimensional model is simplified to obtain each level of detail model, and then each level of detail model needs to achieve the texture resolution.
Further, the preset texture resolution relationship between the hierarchical detail models may be: the texture resolution of each level of detail model is reduced by half step by step, where the texture resolution corresponding to the optimized texture obtained after geometric information optimization and texture information optimization is the most effective utilization texture resolution, and the optimized texture is used as the texture of the finest level of detail model, that is, the most effective utilization texture resolution corresponding to the optimized texture information is used as the texture resolution of the finest level of detail model, and then the texture resolution of each level of detail model from fine to coarse is reduced by half step by step to determine the target texture resolution of each level, that is, in a possible implementation manner of the embodiment of the present application, the step 101 may include:
determining the most effective utilization texture resolution according to the texture information of the original three-dimensional model;
determining the number of model layers according to the most effectively utilized texture resolution and the preset minimum texture resolution;
and determining the target texture resolution of each layer according to the most effective utilization texture resolution, the preset minimum texture resolution, the preset texture resolution relation and the model layer times.
Wherein a minimum texture resolution is presetRate S min The texture resolution of the coarsest level detail model is taken as a power of 2, and the minimum texture resolution S is preset min The value of (b) can be determined according to actual data conditions and application requirements, and the application is not limited thereto.
As a possible implementation, the preset texture resolution relationship may be: from the texture resolution of the fine to coarse hierarchical detail models, the texture resolution S is most effectively utilized max To a predetermined minimum texture resolution S min And the half is reduced step by step.
Illustratively, the most efficient use of the texture resolution S max 2048 × 2048, the minimum texture resolution S is preset min 256 x 256, texture resolution from fine to coarse levels of detail models from the most efficient use of texture resolution S max To a predetermined minimum texture resolution S min The resolution is reduced by half step by step, so that the target texture resolutions of the respective levels are 2048 × 2048, 1024 × 1024, 512 × 512 and 256 × 256.
As a possible implementation, if the texture resolution S is most efficiently utilized max Less than or equal to a predetermined minimum texture resolution S min Then the number of model layers N =1.
As a possible implementation, if the texture resolution S is most efficiently utilized max Greater than a predetermined minimum texture resolution S min And the texture resolution of each level of detail model from fine to coarse is utilized from the most effective texture resolution S max To a predetermined minimum texture resolution S min Halving step by step, the number of model layers N =1+ log 2 (S max /S min ) Each level of target texture resolution S i =S max /2 i-1 Wherein i represents the ith hierarchy (i ≧ 1,1 is the finest hierarchy).
And step 102, determining the maximum geometric simplification error of each level according to the preset texture resolution relationship and the geometric information of the original three-dimensional model.
In the embodiment of the application, because the three-dimensional model rendering takes the image on the display carrier as a final expression form, in the rendered image, most of visual information is texture information from the three-dimensional model, the proportion of the texture information is relatively less, namely, the texture information has a larger influence on the rendering effect, so that when the multi-level detail model is constructed, the texture information is required to be taken as the leading factor, namely, the resolution of the target texture of each level is determined according to the preset texture resolution relation, and then the maximum geometric simplification error of each level is determined, so that the simplification degree of each level of detail model is described more accurately, and the rendering result has a better visual effect.
As a possible implementation manner, since the construction of a multi-level detail model may cause a situation that a texture is too clear or too fuzzy compared with a geometry, which causes data redundancy and affects rendering effect, a matching relationship between geometry information and texture information needs to be considered. Therefore, if the texture resolution of each level of detail model is reduced by half step by step according to the most effective utilization of the texture resolution, the corresponding geometric information is simplified by the size of the geometric length occupied by the corresponding texture pixel, at the moment, the total UV area of the model is the total UV area of the finest level of detail model, and the total UVA area of each level is reduced by 1/4 step by step from the finest level of detail model along with the reduction of the texture resolution, so that the geometric information of each level of detail model is matched with the texture information in the fine degree, and the data redundancy and poor rendering effect caused by the fact that the texture is too clear or too fuzzy compared with the geometry are avoided. Meanwhile, the texture resolution of each level of detail model is reduced by half step by step according to the most effectively utilized texture resolution, so that the fineness of each level of detail model is decreased uniformly, and the corresponding loading distance is changed uniformly (the loading distance is related to the geometric length of each pixel in the corresponding texture). Therefore, switching among the detail models of each level is ideal, frequent switching is avoided, and loading of a finer level model at a position far away from a viewpoint is avoided, so that rendering efficiency and rendering effect are improved.
Further, the geometric pixel ratio of each level may be determined first, and then the maximum geometric simplification error of each level may be obtained according to a preset maximum number of pixels of geometric error, where the preset maximum number of pixels of geometric error refers to a maximum threshold of a number of pixels corresponding to the geometric error rendering of each level of detail model due to simplification, and may be determined according to an actual data situation and an application requirement, which is not limited in this application, that is, in a possible implementation manner of the embodiment of the present application, step 102 may include:
determining the total area of a triangular surface of the model and the total area of UV of the model according to the geometric information of the original three-dimensional model;
determining the total UV area of each layer according to the total UV area of the model and the preset texture resolution relationship;
determining the geometric pixel ratio of each layer according to the total area of the triangular surface of the model and the total area of UV of each layer;
and determining the maximum geometric simplification error of each layer according to the geometric pixel ratio of each layer and the preset maximum pixel number of the geometric error.
The maximum geometric simplification error of each level refers to the geometric length of the maximum pixel number of the geometric error in each level of detail model.
As a possible implementation mode, assuming that the change of the total area of the triangular surface of each layer model in the simplification process can be ignored and is GA, the total area UVA of each layer UV is gradually reduced from the finest layer along with half of the resolution ratio and is 1/4 of the value, and the geometric pixel ratio of each layer is reduced
Where i represents the ith level (i ≧ 1,1 is the finest level). Then setting the maximum pixel number GEP of geometric error
max Geometric error maximum pixel count GEP
max The determination can be performed according to the actual data situation and the application requirement, which is not limited in the present application. Finally, the maximum geometric simplification error E of each layer can be obtained
max,i =GEP
max *GPR
i 。
And 103, simplifying the geometric information of the original three-dimensional model according to the maximum geometric simplification error of each layer to generate a geometric simplified model of each layer.
As a possible implementation manner, in order to ensure the simplification precision, the geometric information and the texture information of each level of initial model may be the same as those of the original three-dimensional model or the optimized three-dimensional model, and then the geometric information is simplified on the basis of each level of initial model.
As another possible implementation, in order to improve simplification efficiency, the geometric information and texture information of the initial model at each level may be determined based on the finer level model. Illustratively, for example, there are 0, 1, 2-level initial models, where the 0 th level is the original three-dimensional model, i.e. the finest level model, the geometric information and the texture information of the 1 st level initial model are the same as those of the 0 th level initial model, and the geometric information and the texture information of the 2 nd level initial model may be directly set to be the same as those of the 0 th level initial model, or may be set to be the same as those of the 1 st level initial model after simplification.
In the embodiment of the application, the geometric information simplification of the initial model of each level is independently completed.
As a possible implementation manner, geometric information simplification may be performed by removing geometric elements of the initial model at each level to obtain geometric data of the geometric simplified model at each level. When geometric information simplification is carried out, errors exist correspondingly, simplification needs to be stopped when the errors exceed the maximum geometric simplification error corresponding to the initial model of the hierarchy, and the current geometric elements need to be removed.
As a possible implementation manner, in order to facilitate practical application of a subsequent multi-level detail model, after geometric information simplification is completed, related description parameters of the simplified geometric information need to be calculated and recorded, where the related description parameters of the simplified geometric information may include parameters such as a total number of vertices of a model, a total number of triangular faces of the model, a total area of triangular faces of the model, geometric errors of the model, a box surrounding the outside of the model, and a sphere surrounding the outside of the model, and other related parameters may be extended according to actual data conditions and application requirements, which is not limited in the embodiment of the present application.
And step 104, according to the target texture resolution of each level, simplifying texture information of the geometric simplified model of each level to generate a detailed model of each level.
In the embodiment of the application, the texture information simplification of each level of geometric simplification model is independently completed.
As a possible implementation manner, the simplified geometric models of each hierarchy may be used as basic data, where texture data of the simplified geometric models of each hierarchy is texture data optimized by texture information, and then texture information corresponding to the simplified geometric data in the simplified geometric models of each hierarchy is remapped to a corresponding resolution by using geometric areas of the triangular surfaces as weights according to a target texture resolution of each hierarchy, so as to complete texture information simplification.
As a possible implementation manner, in order to facilitate the practical application of the subsequent multi-level detail model, after the texture information simplification is completed, the related description parameters of the simplified model information need to be calculated and recorded, where the related description parameters of the simplified model information may include parameters such as the model texture resolution, the model UV total area, the model geometric pixel ratio, and the like, and are combined with the related description parameters of the simplified geometric information to jointly form the information description parameters of the simplified multi-level detail model.
And 105, constructing an index relation among the detail models of all levels to generate a multi-level detail model.
Further, the connection may be performed sequentially according to the level of fineness of each level of detail model, that is, in a possible implementation manner of the embodiment of the present application, the step 105 may include:
and connecting the detail models of each hierarchy in sequence according to the texture resolution corresponding to the detail models of each hierarchy to generate a multi-level detail model.
As a possible implementation manner, in the index, each level of detail model is expressed by one node, the texture data storage path, the geometric data storage path and the information description parameters of each level of detail model corresponding to the level of detail model are recorded in the node, parent-child relationship connection is performed between the nodes according to the fineness degree, the node corresponding to the coarsest level of detail model is taken as a root node, the nodes corresponding to finer levels are connected downwards sequentially as child nodes until the finest level is a leaf node, the construction of the index relationship is completed, and the texture information, the geometric information and the index relationship between each level of detail model are stored in the database.
In the embodiment of the application, each level of detail model has independent geometric information and texture information, can be independently loaded, and gradually decreases from fine to coarse in data quantity level by level. Therefore, the data loading efficiency can be improved, only the detail level model with the most appropriate fineness degree is loaded according to the viewpoint position during actual rendering, and the efficient dynamic loading scheduling of the multi-level detail model is realized.
The method for constructing a multi-level detail model disclosed in the embodiments of the present application includes determining a target texture resolution of each level according to texture information of an original three-dimensional model and a preset texture resolution relationship between detail models of each level, determining a maximum geometric simplification error of each level according to the preset texture resolution relationship and geometric information of the original three-dimensional model, sequentially simplifying the geometric information and simplifying the texture information of the original three-dimensional model by combining the maximum geometric simplification error of each level and the target texture resolution of each level to generate detail models of each level, and finally constructing an index relationship between detail models of each level to generate the multi-level detail model. Therefore, the target texture resolution of each level is determined firstly through the preset texture resolution relation, so that the simplification degree of each level of detail model is represented by the simplification degree of the texture information which has relatively large influence on the rendering effect, the simplification degree of each level of detail model is described more accurately, and the rendering effect is greatly improved.
Referring to fig. 2, a schematic flow chart of a method for constructing a multi-level detail model provided in the second embodiment of the present application is shown. As shown in fig. 2, the method for constructing a multi-level detail model may include the following steps:
step 201, determining the target texture resolution of each level according to the texture information of the original three-dimensional model and the preset texture resolution relationship between the detail models of each level.
Step 202, determining the maximum geometric simplification error of each level according to the preset texture resolution relation and the geometric information of the original three-dimensional model.
The detailed implementation process and principle of the steps 201-202 may refer to the detailed description of the above embodiments, and are not described herein again.
And step 203, acquiring initial models of each hierarchy.
In this embodiment of the application, the geometric information and the texture information of each level of the initial model may be the same as those of the original three-dimensional model or the optimized three-dimensional model, or may be generated based on a certain finer level model, and the description of each level of the initial model may refer to step 103, which is not described herein again.
Step 204, determining that each geometric element in the geometric information of the initial model at any level removes geometric errors generated on the geometric information of the initial model at any level.
As a possible implementation manner, a certain level initial model may be used as basic data, and then geometric errors brought to geometric information of the level initial model by removing each geometric element (point, edge, or surface) are calculated, where the geometric errors may adopt different methods according to actual data conditions and application requirements, and the embodiments of the present application do not limit this.
And step 205, removing the geometric elements with the smallest geometric error in sequence until the geometric error is larger than the largest geometric simplification error corresponding to the hierarchical initial model to be simplified in each hierarchical maximum geometric simplification error or the number of the remaining geometric elements in the geometric information of any hierarchical initial model is smaller than the preset minimum geometric element number of any hierarchical initial model, and removing the current geometric elements to generate the hierarchical geometric simplification model corresponding to any hierarchical initial model.
In the embodiment of the application, after each removal of the geometric element, each geometric element remaining in the geometric information of any level of the initial model is determined again to remove the geometric error generated on the geometric information of any level of the initial model.
As a possible implementation, the geometric element removal critical condition is first set: and stopping operation as long as one of critical conditions is reached when the geometric elements are removed.
As a possible implementation manner, the geometric errors corresponding to the removal of the geometric elements may be sorted from small to large, the geometric elements with the smallest errors are removed successively, the operation is stopped until the errors exceed the maximum geometric simplification error corresponding to the hierarchical initial model, the removal of the current geometric elements is cancelled, and after each removal, the geometric elements associated with the removed geometric elements are obtained, the geometric errors corresponding to the geometric elements associated with the removed geometric elements are recalculated, and the geometric errors are updated.
As a possible implementation manner, the method for removing geometric elements may adopt different methods according to actual data conditions and application requirements, for example, an edge collapse method, a vertex deletion method, a vertex clustering method, a face contraction process method, and the like, which is not limited in this embodiment of the present application.
And step 206, according to the target texture resolution of each level, simplifying the texture information of the geometric simplified model of each level to generate a detailed model of each level.
And step 207, constructing an index relationship among the detail models of each level to generate a multi-level detail model.
The detailed implementation process and principle of the steps 206 to 207 may refer to the detailed description of the above embodiments, and are not described herein again.
The method for constructing a multi-level detail model disclosed in the above embodiments of the present application includes determining a resolution of a target texture of each level and a maximum geometric simplification error of each level, generating an initial model of each level according to geometric information and texture information of an original three-dimensional model, determining that each geometric element in the geometric information of any level of the initial model removes a geometric error generated on the geometric information of the level of the initial model, further sequentially removing the geometric element corresponding to the minimum geometric error until a critical condition for removing the geometric element is reached, generating a level geometric simplification model corresponding to the level of the initial model, and finally generating the multi-level detail model. Therefore, geometric data of each level of geometric simplified models are obtained through geometric element removal operation of each level of initial models, and geometric information is effectively simplified.
Referring to fig. 3, a schematic flow chart of a method for constructing a multi-level detail model provided in the third embodiment of the present application is shown. As shown in fig. 3, the method for constructing a multi-level detail model may include the following steps:
step 301, determining the target texture resolution of each hierarchy according to the texture information of the original three-dimensional model and the preset texture resolution relationship between the detail models of each hierarchy.
Step 302, determining the maximum geometric simplification error of each layer according to the preset texture resolution relation and the geometric information of the original three-dimensional model.
And 303, simplifying the geometric information of the original three-dimensional model according to the maximum geometric simplification error of each layer to generate a geometric simplification model of each layer.
The detailed implementation process and principle of the steps 301 to 303 may refer to the detailed description of the above embodiments, and are not described herein again.
And 304, remapping the texture information corresponding to each triangular surface by taking the geometric area of each triangular surface in the geometric information in any level of geometric simplified model as a weight so as to adjust the texture resolution in the texture information of any level of geometric simplified model to the target texture resolution corresponding to any level of geometric simplified model and generate a level detail model corresponding to any level of geometric simplified model.
As a possible implementation manner, in the texture remapping process, the geometric area of the triangular surface is used as the weight to perform mapping of the new texture, so as to obtain the texture of the target texture resolution, and the triangular surface with a larger area in the simplified hierarchical detail model is distributed with more pixels in the texture obtained by remapping, so that the texture fineness of the whole model is more balanced.
And 305, constructing an index relation between the detail models of all levels to generate a multi-level detail model.
For the detailed implementation process and principle of the step 305, reference may be made to the detailed description of the above embodiments, which is not described herein again.
The method for constructing a multi-level detail model disclosed in the above embodiments of the present application includes determining a target texture resolution of each level and a maximum geometric simplification error of each level, then simplifying geometric information of an original three-dimensional model to generate a geometric simplified model of each level, remapping texture information corresponding to each triangular surface by using a geometric area of each triangular surface in the geometric information of any level of the geometric simplified model as a weight, adjusting the texture resolution of the texture information of the geometric simplified model of the level to the target texture resolution of the geometric simplified model of the level, generating a level detail model corresponding to the geometric simplified model of the level, further generating a level detail model of each level, and finally constructing an index to generate the multi-level detail model. Therefore, the texture information is remapped by taking the geometric area of the triangular surface as the weight according to the target texture resolution of each level, so that the simplification of the texture information can be effectively realized.
Referring to fig. 4, a schematic structural diagram of a multi-level detail model building apparatus provided in the fourth embodiment of the present application is shown, and for convenience of description, only the parts related to the embodiment of the present application are shown.
The multi-level detail model construction device specifically comprises the following modules:
and a target texture resolution determining module 401, configured to determine the target texture resolution of each level according to the texture information of the original three-dimensional model and a preset texture resolution relationship between detail models of each level.
A maximum geometric simplification error determining module 402, configured to determine the maximum geometric simplification error of each hierarchy according to the preset texture resolution relationship and the geometric information of the original three-dimensional model.
And a geometric simplified model generation module 403, configured to perform geometric information simplification on the original three-dimensional model according to the maximum geometric simplified error of each hierarchy, so as to generate geometric simplified models of each hierarchy.
And the hierarchical detail model generation module 404 is configured to perform texture information simplification on each hierarchical geometric simplified model according to the target texture resolution of each hierarchical level, so as to generate each hierarchical detail model.
And a multi-level detail model generation module 405, configured to construct an index relationship between the detail models of different levels to generate a multi-level detail model.
The multi-level detail model construction device disclosed in the above embodiment of the present application determines the target texture resolution of each level according to the texture information of the original three-dimensional model and the preset texture resolution relationship between the detail models of each level, determines the maximum geometric simplification error of each level according to the preset texture resolution relationship and the geometric information of the original three-dimensional model, sequentially simplifies the geometric information and the texture information of the original three-dimensional model by combining the maximum geometric simplification error of each level and the target texture resolution of each level to generate the detail models of each level, and finally constructs the index relationship between the detail models of each level to generate the multi-level detail model. Therefore, the target texture resolution of each level is determined through the preset texture resolution relation, so that the simplification degree of each level of detail model is represented by the simplification degree of the texture information which has relatively great influence on the rendering effect, the simplification degree of each level of detail model is more accurately described, and the rendering effect is greatly improved.
In this embodiment, in four possible implementation manners of this embodiment, the target texture resolution determining module 401 may specifically include the following sub-modules:
and the most effective utilization texture resolution determining submodule is used for determining the most effective utilization texture resolution according to the texture information of the original three-dimensional model.
And the layer number determining submodule is used for determining the layer number of the model according to the most effective utilization texture resolution and the preset minimum texture resolution.
And the target texture resolution determining submodule is used for determining the target texture resolution of each layer according to the most effective utilization texture resolution, the preset minimum texture resolution, the preset texture resolution relation and the model layer number.
As a possible implementation manner, the preset texture resolution relationship may be: the texture resolution of each level of detail models from fine to coarse is reduced by half step from the most effective texture resolution to the preset minimum texture resolution.
In this embodiment, in four possible implementation manners of this embodiment, the maximum geometric simplification error determination module 402 may specifically include the following sub-modules:
and the model UV total area determining submodule is used for determining the total area of the triangular surface of the model and the total area of the model UV according to the geometric information of the original three-dimensional model.
And the UV total area determining submodule of each layer is used for determining the UV total area of each layer according to the UV total area of the model and the preset texture resolution relation.
And the geometric pixel ratio determining submodule is used for determining the geometric pixel ratio of each layer according to the total area of the triangular surface of the model and the total area of UV of each layer.
And the maximum geometric simplification error determination submodule is used for determining the maximum geometric simplification error of each layer according to the geometric pixel ratio of each layer and the preset maximum pixel number of the geometric errors.
In this embodiment, in four possible implementation manners of the embodiment of the present application, the geometric simplified model generation module 403 may specifically include the following sub-modules:
and each level initial model generation submodule is used for acquiring each level initial model.
And the geometric error determining submodule is used for determining that each geometric element in the geometric information of the initial model at any level removes the geometric error generated on the geometric information of the initial model at any level.
And the hierarchical geometric simplification model generation submodule is used for removing the geometric elements which enable the geometric errors to be minimum in sequence until the geometric errors are larger than the maximum geometric simplification errors corresponding to the hierarchical initial model to be simplified in the maximum geometric simplification errors of all the hierarchies or the number of the residual geometric elements in the geometric information of any hierarchical initial model is smaller than the preset minimum geometric element number of any hierarchical initial model, and removing the current geometric elements to generate the hierarchical geometric simplification model corresponding to any hierarchical initial model.
And after each removal of the geometric elements, re-determining each residual geometric element in the geometric information of the initial model at any level to remove geometric errors generated on the geometric information of the initial model at any level.
In this embodiment, in four possible implementation manners of this embodiment, the hierarchical detail model generating module 404 may specifically include the following sub-modules:
and the hierarchical detail model generation submodule is used for remapping the texture information corresponding to each triangular surface by taking the geometric area of each triangular surface in the geometric information in any hierarchical geometric simplified model as a weight so as to adjust the texture resolution in the texture information of any hierarchical geometric simplified model to the target texture resolution corresponding to any hierarchical geometric simplified model and generate the hierarchical detail model corresponding to any hierarchical geometric simplified model.
In this embodiment, in four possible implementation manners of this embodiment, the multilevel detail model generating module 405 may specifically include the following sub-modules:
and the multi-level detail model generation submodule is used for sequentially connecting the detail models of each level according to the texture resolution corresponding to the detail models of each level so as to generate the multi-level detail model.
In this embodiment, in four possible implementation manners of this embodiment, the apparatus for constructing a multi-level detail model may further include:
and the geometric information optimization module is used for carrying out geometric information optimization on the original three-dimensional model before determining the texture resolution of each level according to the texture information of the original three-dimensional model and the preset texture resolution relation of each level of detail model.
Wherein the geometric information optimization comprises: and removing repeated triangular faces in the geometric information of the original three-dimensional model, removing invisible triangular faces in the geometric information of the original three-dimensional model, and repairing wrong triangular faces.
In this embodiment, in four possible implementation manners of this embodiment, the apparatus for constructing a multi-level detail model may further include:
the texture information optimization module is used for determining the most effective utilization texture resolution according to the texture information of the original three-dimensional model before determining the resolution of each level of texture according to the texture information of the original three-dimensional model and the preset texture resolution relation of each level of detail model; and carrying out texture information optimization on the original three-dimensional model.
Wherein the texture information optimization comprises: and remapping the texture information corresponding to each triangular surface by taking the UV area corresponding to each triangular surface in the geometric information in the original three-dimensional model as a weight so as to adjust the texture resolution in the texture information of the original three-dimensional model to the most effective texture resolution.
The multi-level detail model construction device disclosed in the above embodiment of the present application determines a target texture resolution of each level and a maximum geometric simplification error of each level, generates an initial model of each level according to geometric information and texture information of an original three-dimensional model, determines that each geometric element in the geometric information of an initial model of any level removes a geometric error generated on the geometric information of the initial model of any level, further removes the geometric element corresponding to the minimum geometric error in sequence until a critical condition for removing the geometric element is reached, generates a geometric simplification model of a level corresponding to the initial model of any level, and finally generates a multi-level detail model. Therefore, geometric data of each level of geometric simplified models are obtained through geometric element removal operation of each level of initial models, and geometric information is effectively simplified.
The multilevel detail model construction device provided in the embodiment of the present application may be applied to the foregoing method embodiments, and for details, reference is made to the description of the foregoing method embodiments, and details are not described herein again.
Fig. 5 is a schematic structural diagram of a terminal device according to a fifth embodiment of the present application. As shown in fig. 5, the terminal device 500 of this embodiment includes: at least one processor 510 (only one shown in fig. 5), a memory 520, and a computer program 521 stored in the memory 520 and operable on the at least one processor 510, wherein the processor 510 executes the computer program 521 to implement the steps of the multi-level detail model building method embodiments.
The terminal device 500 may be a desktop computer, a notebook, a palm computer, a cloud server, or other computing devices. The terminal device may include, but is not limited to, a processor 510, a memory 520. Those skilled in the art will appreciate that fig. 5 is only an example of the terminal device 500, and does not constitute a limitation to the terminal device 500, and may include more or less components than those shown, or may combine some components, or different components, and may further include, for example, an input/output device, a network access device, and the like.
The Processor 510 may be a Central Processing Unit (CPU), and the Processor 510 may be other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic, discrete hardware components, etc. A general purpose processor may be a microprocessor or the processor may be any conventional processor or the like.
The memory 520 may in some embodiments be an internal storage unit of the terminal device 500, such as a hard disk or a memory of the terminal device 500. The memory 520 may also be an external storage device of the terminal device 500 in other embodiments, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), etc. provided on the terminal device 500. Further, the memory 520 may also include both an internal storage unit and an external storage device of the terminal device 500. The memory 520 is used for storing an operating system, an application program, a Boot Loader (Boot Loader), data, and other programs, such as program codes of the computer programs. The memory 520 may also be used to temporarily store data that has been output or is to be output.
It will be apparent to those skilled in the art that, for convenience and brevity of description, only the above-mentioned division of the functional units and modules is illustrated, and in practical applications, the above-mentioned function distribution may be performed by different functional units and modules according to needs, that is, the internal structure of the apparatus is divided into different functional units or modules to perform all or part of the above-mentioned functions. Each functional unit and module in the embodiments may be integrated in one processing unit, or each unit may exist alone physically, or two or more units are integrated in one unit, and the integrated unit may be implemented in a form of hardware, or in a form of software functional unit. In addition, specific names of the functional units and modules are only for convenience of distinguishing from each other, and are not used for limiting the protection scope of the present application. The specific working processes of the units and modules in the system may refer to the corresponding processes in the foregoing method embodiments, and are not described herein again.
In the above embodiments, the descriptions of the respective embodiments have respective emphasis, and reference may be made to the related descriptions of other embodiments for parts that are not described or illustrated in a certain embodiment.
Those of ordinary skill in the art will appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware or combinations of computer software and electronic hardware. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
In the embodiments provided in the present application, it should be understood that the disclosed apparatus/terminal device and method may be implemented in other ways. For example, the above-described embodiments of the apparatus/terminal device are merely illustrative, and for example, the division of the modules or units is only one logical division, and there may be other divisions when actually implemented, 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 through some interfaces, indirect coupling or communication connection of devices or units, 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 application 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 integrated unit may be implemented in the form of hardware, or may also be implemented in the form of a software functional unit.
The integrated modules/units, if implemented in the form of software functional units and sold or used as separate products, may be stored in a computer readable storage medium. Based on such understanding, all or part of the flow in the method of the embodiments described above can be realized by a computer program, which can be stored in a computer-readable storage medium and can realize the steps of the embodiments of the methods described above when the computer program is executed by a processor. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, U.S. disk, removable hard disk, magnetic diskette, optical disk, computer Memory, read-Only Memory (ROM), random Access Memory (RAM), electrical carrier wave signal, telecommunications signal, and software distribution medium, etc. It should be noted that the computer-readable medium may contain suitable additions or subtractions depending on the requirements of legislation and patent practice in jurisdictions, for example, in some jurisdictions, computer-readable media may not include electrical carrier signals or telecommunication signals in accordance with legislation and patent practice.
When the computer program product runs on a terminal device, the steps in the method embodiments can be implemented when the terminal device executes the computer program product.
The above-mentioned embodiments are only used for illustrating the technical solutions of the present application, and not for limiting the same. Although the present application has been described in detail with reference to the foregoing embodiments, it should be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; such modifications and substitutions do not substantially depart from the spirit and scope of the embodiments of the present application and are intended to be included within the scope of the present application.