Method, device and electronic device for generating LOD data
By adjusting the initial simplified parameters in similarity, the LOD data is automatically generated, which solves the problem of low generation efficiency in the existing technology and realizes efficient and accurate LOD data generation.
Patent Information
- Application Number
- CN202110898528.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2021-08-05
- Publication Date
- 2025-08-22
- Estimated Expiration
- 2041-08-05
AI Technical Summary
The generation efficiency of existing LOD data is inefficient and depends on the subjective judgment of modelers, resulting in inefficient generation and inconsistent results.
By obtaining the original model data and initial simplification parameters, adjusting the initial simplification parameters with similarity, and automatically generating LOD data, ensuring that the generation efficiency is improved on the basis of the maximum preservation of the original model characteristics.
It realizes the automated generation of LOD data, improves generation efficiency and accuracy, reduces human intervention, and improves loading speed and interactive experience.
Smart Images

Figure CN115705444B_ABST
Abstract
Description
Technical Field
[0001] The present invention relates to the technical field of computer-aided design, and in particular to a method, device and electronic equipment for generating LOD data. Background Art
[0002] Currently, 3D display technology is being used more and more widely, playing an important role in industrial design, gaming, virtual and augmented reality, film and television, and other fields. As the requirements for image refinement and realism continue to increase, the amount of data displayed in 3D has also increased massively. However, due to limited hardware performance, loading a detailed model of the entire scene at once would inevitably require a large amount of hardware resources, which in turn would cause performance issues such as lag and crashes. Therefore, the Levels of Detail (LOD) strategy was created, which is used to divide the details into different levels according to the degree of refinement. That is, the coarse model of distant locations and unimportant content is loaded instead, and the detailed model is only loaded when the distance becomes closer or when it is of interest.
[0003] Existing LOD data is typically created manually by modelers or generated using tools that adjust numerous parameters. Manual creation requires repeated revisions to achieve the final result, while tool generation requires constant parameter adjustments to achieve optimal results. Furthermore, the quality of the results is often determined by technicians, which is highly subjective. Consequently, the level of sophistication of existing LOD data relies on the modeler, and a significant number of LOD effects in 3D scenes are manually created by modelers, resulting in low LOD data generation efficiency. Summary of the Invention
[0004] In view of this, embodiments of the present invention provide a method, apparatus, and electronic device for generating LOD data to solve the problem of low efficiency in generating LOD data.
[0005] According to a first aspect, an embodiment of the present invention provides a method for generating LOD data, comprising:
[0006] Obtain original model data and initial simplified parameters;
[0007] Simplifying the original model data based on the initial simplification parameters to obtain simplified model data, and determining the similarity between the original model data and the simplified model data;
[0008] The initial simplification parameters are adjusted according to the similarity to simplify the original model data again and determine the LOD data corresponding to the original model data.
[0009] The LOD data generation method provided by the embodiment of the present invention adjusts the initial simplification parameters by the similarity between the original model data and the simplified model data, thereby realizing automatic adjustment of the initial simplification parameters. The automatic adjustment is performed based on the similarity, and the similarity is obtained by using the simplified model data and the original model data. The reliability of the automatically adjusted initial simplification parameters can be guaranteed on the basis of retaining the characteristics of the original model data to the greatest extent. At the same time, since the entire LOD data generation process is automatically processed and does not require human intervention, the efficiency of generating LOD data is improved.
[0010] In combination with the first aspect, in a first implementation of the first aspect, adjusting the initial simplification parameters according to the similarity to further simplify the original model data and determining the LOD data corresponding to the original model data includes:
[0011] Obtaining an initial upper limit and an initial lower limit corresponding to the initial simplified parameter;
[0012] Based on the relationship between the similarity and the threshold, adjusting the initial simplified parameter using the initial upper limit and the initial lower limit to obtain an adjusted simplified parameter;
[0013] The original model data is simplified again using the adjusted simplification parameters to determine LOD data corresponding to the original model data.
[0014] In the LOD data generation method provided by an embodiment of the present invention, the threshold represents the expected value of simplification, and the adjustment direction of the initial simplification parameters is guided by the size relationship between the similarity and the threshold. That is, the initial simplification parameters are adjusted by the initial upper and lower limits, thereby ensuring the accuracy of the adjusted simplification parameters, and dynamically obtaining LOD data that meets the threshold requirements and is optimal in terms of data volume. In addition, the LOD level generation process is automatic and does not require human intervention, thereby improving the level of automation. Obtaining data also improves loading speed and interactive experience.
[0015] In combination with the first embodiment of the first aspect, in the second embodiment of the first aspect, adjusting the initial simplified parameter based on the relationship between the similarity and the threshold using the initial upper limit and the initial lower limit to obtain the adjusted simplified parameter includes:
[0016] Using the relationship between the similarity and the threshold, the initial upper limit and the initial lower limit are adjusted to obtain an adjusted upper limit and a lower limit;
[0017] Based on the adjusted upper limit and lower limit, the initial simplified parameter is adjusted to obtain an adjusted simplified parameter.
[0018] The LOD data generation method provided by an embodiment of the present invention first adjusts the initial upper and lower limits using the size relationship between the similarity and the threshold. Since the threshold is the expected value that characterizes the simplification, the initial simplification parameters are adjusted on this basis, which can reduce the number of times the initial simplification parameters are adjusted and improve the efficiency of LOD data generation.
[0019] In combination with the second embodiment of the first aspect, in the third embodiment of the first aspect, adjusting the initial upper limit and lower limit by utilizing the relationship between the similarity and the threshold to obtain the adjusted upper limit and lower limit includes:
[0020] When the similarity is less than the threshold, increasing the initial lower limit to obtain an adjusted lower limit;
[0021] When the similarity is greater than the threshold, the initial upper limit is reduced to obtain an adjusted upper limit.
[0022] The method for generating LOD data provided by an embodiment of the present invention, when the similarity is greater than a threshold, it indicates that parameters closer to the lower limit can be used for simplification; when the similarity is less than the threshold, it indicates that parameters closer to the upper limit can be used for simplification. Based on this, the initial upper and lower limits are adjusted accordingly to meet the adjustment requirements.
[0023] In combination with the second implementation or the third implementation of the first aspect, in the fourth implementation of the first aspect, adjusting the initial simplified parameters based on the adjusted upper and lower limits to obtain the adjusted simplified parameters includes:
[0024] Calculating the mean of the adjusted upper and lower limits;
[0025] The mean value is determined as the adjusted simplified parameter.
[0026] The LOD data generation method provided by the embodiment of the present invention obtains the adjusted simplified parameters through a dichotomy method, and finally obtains a global optimal solution that meets the conditions through iteration.
[0027] In combination with the first embodiment of the first aspect, in the fifth embodiment of the first aspect, further simplifying the original model data using the adjusted simplification parameters to determine LOD data corresponding to the original model data includes:
[0028] Determining whether the difference between the adjusted upper limit and lower limit meets a stop condition;
[0029] When the stop condition is not met, adjusting the initial simplified parameter using the adjusted upper limit and lower limit to obtain the adjusted simplified parameter;
[0030] The original model data is simplified again using the adjusted simplification parameters to determine LOD data corresponding to the original model data.
[0031] The LOD data generation method provided by the embodiment of the present invention, since the interval between the upper limit and the lower limit represents the adjustable range of the simplification parameter, when the adjustable range is small, even if the model is simplified, it is meaningless. Therefore, the relationship between the difference between the adjusted upper and lower limits and the stopping condition is used to determine whether to continue the simplification, thereby reducing invalid model simplification and improving the efficiency of LOD data generation.
[0032] In combination with the first aspect, in a sixth implementation of the first aspect, the simplification of the original model data based on the initial simplification parameters to obtain simplified model data, and determining the similarity between the original model data and the simplified model data includes:
[0033] Simplifying the original model data using the initial simplified parameters to obtain simplified model data;
[0034] Converting the original model data and the simplified model data into two-dimensional representations respectively to obtain an original data image and a simplified data image;
[0035] The similarity is determined based on the features of the original data image and the features of the simplified data image.
[0036] In the LOD data generation method provided by an embodiment of the present invention, similarity is calculated based on a two-dimensional image of a three-dimensional model, rather than directly using the three-dimensional model. Processing using two-dimensional images is faster because the unit of calculation for two-dimensional image similarity is pixels, and the amount of calculation may be only tens of thousands to hundreds of thousands. In contrast, calculations based on three-dimensional models use the number of triangles or vertices, which may be tens of millions or more. This method is more intuitive: placing two images together makes it easy to see the effect, while three-dimensional models must be displayed in three-dimensional space. It is also easier to process material information: after generating an image, the model's geometric and material information can be simultaneously reflected, while most comparison algorithms based on three-dimensional models focus only on geometric information. Furthermore, it is more realistic: when a three-dimensional model is displayed on a screen, it has already collapsed into two dimensions. Therefore, when a person subjectively judges whether two models are similar, they are already making a judgment based on the two-dimensional image.
[0037] According to a second aspect, an embodiment of the present invention further provides a device for generating LOD data, comprising:
[0038] An acquisition module is used to obtain original model data and initial simplified parameters;
[0039] a simplification module, configured to simplify the original model data based on the initial simplification parameters to obtain simplified model data, and determine a similarity between the original model data and the simplified model data;
[0040] An adjustment module is used to adjust the initial simplification parameters according to the similarity to further simplify the original model data and determine the LOD data corresponding to the original model data.
[0041] The LOD data generation device provided by the embodiment of the present invention adjusts the initial simplification parameters by the similarity between the original model data and the simplified model data, thereby realizing automatic adjustment of the initial simplification parameters. The automatic adjustment is performed based on the similarity, and the similarity is obtained by using the simplified model data and the original model data. The reliability of the automatically adjusted initial simplification parameters can be guaranteed on the basis of retaining the characteristics of the original model data to the greatest extent. At the same time, since the entire LOD data generation process is automatically processed and does not require human intervention, the efficiency of generating LOD data is improved.
[0042] According to the third aspect, an embodiment of the present invention provides an electronic device, comprising: a memory and a processor, the memory and the processor being communicatively connected to each other, the memory storing computer instructions, and the processor executing the computer instructions to execute the LOD data generation method described in the first aspect or any one of the embodiments of the first aspect.
[0043] According to a fourth aspect, an embodiment of the present invention provides a computer-readable storage medium, which stores computer instructions, and the computer instructions are used to enable the computer to execute the LOD data generation method described in the first aspect or any one of the embodiments of the first aspect. BRIEF DESCRIPTION OF THE DRAWINGS
[0044] In order to more clearly illustrate the specific embodiments of the present invention or the technical solutions in the prior art, the following briefly introduces the drawings required for use in the specific embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying any creative work.
[0045] Figure 1a-Figure 1d A schematic diagram showing LOD data;
[0046] Figure 1e A schematic diagram showing the application of LOD data at different levels;
[0047] Figure 2is a flowchart of a method for generating LOD data according to an embodiment of the present invention;
[0048] Figure 3a-Figure 3b A schematic diagram showing the original model data and the simplified model data when observed at a close distance is shown;
[0049] Figure 3c-3d A schematic diagram showing the original model data and the simplified model data when observed from a distance;
[0050] Figure 4 is a flowchart of a method for generating LOD data according to an embodiment of the present invention;
[0051] Figure 5 is a flowchart of a method for generating LOD data according to an embodiment of the present invention;
[0052] Figure 6 is a flowchart of a method for generating LOD data according to an embodiment of the present invention;
[0053] Figure 7 is a structural block diagram of a device for generating LOD data according to an embodiment of the present invention;
[0054] Figure 8 It is a schematic diagram of the hardware structure of the electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0055] To make the purpose, technical solutions, and advantages of the embodiments of the present invention more clear, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the accompanying drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without making creative efforts shall fall within the scope of protection of the present invention.
[0056] LOD is a graphic display that represents the level of detail of graphics elements through different levels. If a geometric shape is far away from the viewing position, it can be replaced by a rough shape, and there will not be much visual difference. Specifically, in graphic display, all planes and curved surfaces are composed of triangular meshes or quadrilateral meshes. The finer the geometric shape, the more triangles are required, and the higher the computing performance requirements. In other words, under certain computing performance, the more detailed the model, the more difficult it is to display. If the model is too detailed, it will be stuck, crashed, etc. Therefore, it is necessary to use LOD data for display.
[0057] Figure 1a-Figure 1dThe LOD data of different levels are shown, wherein the fineness thereof is gradually reduced. The LOD data with higher fineness can be loaded at a position closer to the observation position, and the LOD data with lower fineness can be loaded at a position farther from the observation position. That is, Figure 1e Shown Figure 1a-Figure 1d The specific application of LOD data at each level. It should be noted that Figure 1a-Figure 1e It is only used to represent the LOD data of different levels, and is not a photo or filled image.
[0058] Therefore, in order to generate LOD data at different levels, the solution proposed by the present invention is: adaptively adjust the simplification parameters to meet the requirements of generating LOD data at different levels.
[0059] It should be noted that the method for generating LOD data described in the embodiment of the present invention can be applied in the fields of building information modeling, city information modeling or geographic information system. Specifically, the building information model mainly deals with the virtualization realization of the three-dimensional model of the building space, and uses digital technology to process information of each life stage of the building model, including design, construction, operation and maintenance, etc. The information includes spatial geometry information, professional attributes and status information. Geographic information system refers to the collection, storage, calculation and analysis of geographic distribution data in the earth's surface space through digital technology. The city information model is a system for urban planning, construction, operation and maintenance constructed on the basis of the urban geographic information system, with the addition of the building information model of a single building, combined with municipal facilities such as urban roads, bridges and tunnels, rail transit, underground pipelines, etc.
[0060] According to an embodiment of the present invention, an embodiment of a method for generating LOD data is provided. It should be noted that the steps shown in the flowchart of the accompanying drawings can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases, the steps shown or described can be executed in an order different from that shown here.
[0061] In this embodiment, a method for generating LOD data is provided, which can be used in electronic devices such as computers, mobile phones, tablet computers, etc. Figure 2 : is a flow chart of a method for generating LOD data according to an embodiment of the present invention. Figure 2 As shown, the process includes the following steps:
[0062] S11, obtaining original model data and initial simplified parameters.
[0063] Original model data is 3D model data, which is usually extracted from the scene and contains geometric information and material information. Original model data is the basis for subsequent model simplification.
[0064] Geometric information can generally be expressed as a combination of position, normal, uv and index, where position is a set of vector3f data, each data represents a point in space; normal is a set of vector3f data, each data represents the normal direction of the corresponding point in space; uv is a set of vector2f data, each data represents the material coordinates of the corresponding vertex in the map; index is a set of vector3i data, each data (i, j, k) represents the triangle composed of the i-th vertex, the j-th vertex and the k-th vertex.
[0065] Among them, material information includes parameters and maps such as diffuse color and metal roughness. The maps include normal maps, diffuse maps, lighting maps, occlusion maps and self-illumination maps.
[0066] Of course, the data included in the original model data is not limited to the geometric information or material information mentioned above, and may also include other information. The specific configuration can be based on actual needs and is not limited to any restrictions herein. For example, the information included in the original model data here can be determined based on the data required for the subsequent simplified model.
[0067] Initial simplified parameters are not limited to the parameters used when the model is first simplified; they can also represent the current simplified parameters. The purpose of using initial simplified parameters is simply to distinguish them from subsequently adjusted simplified parameters and they have no special meaning. The number of parameters included in the initial simplified parameters is determined based on the subsequent model simplification method used. The specific values of each parameter can be set based on empirical values or determined based on experimental results, etc.
[0068] S12, simplifying the original model data based on the initial simplified parameters to obtain simplified model data, and determining the similarity between the original model data and the simplified model data.
[0069] The electronic device simplifies the original model data using the initial simplification parameters to obtain simplified model data. For example, the original model data may be simplified or shelled using the corresponding initial simplification parameters. The simplification of the original model data is not limited to "simplification" and may also be performed by shelling, etc., as long as the fineness of the original model data can be reduced. The specific simplification method is not limited herein.
[0070] Among them, when the "simplification" method is used to simplify the original model data, the methods used are: vertex clustering method based on vertex position distribution, edge collapse iteration method based on vertex distance, and surface degeneration method based on quadratic error; when the shelling method is used to simplify the original model data, the methods used are: stretching according to the projection contour or layered contour local stretching combination, etc.
[0071] When the simplified model data is obtained by using the above method, the simplified model data can also be called LOD layer model data. When observed at the same distance, the simplified model data becomes more blurred, that is, the simplified model data is a rough version of the original model data, but its data volume becomes smaller, and the resource requirements and pressure on the display engine are also smaller. For example, Figure 3a shows the original model data, Figure 3b The corresponding simplified model data is shown. By comparison, it can be seen that the precision of the simplified model data is lower than that of the original model data.
[0072] On the other hand, when the viewing distance is far, the original data and LOD data are visually equivalent, and the simplified model data can be used to replace the original model data. For example, Figure 3c shows the original model data for long-distance observation, Figure 3d The simplified model data for long-distance viewing is shown. By comparison, it can be seen that when viewed from a distance, the original model data and the simplified model data are visually equivalent and indistinguishable. Therefore, in order to reduce the resource requirements of the display engine, the simplified model data can be used instead of the original model data when viewed from a distance. It should be noted that Figure 3a-3d It is only for the purpose of visually representing the model data before and after simplification, and is not a photo or filled picture.
[0073] After obtaining the simplified model data, the electronic device can calculate the similarity between the original model data and the simplified model data. For example, the simplified model data and the original model data can be converted into matrix representations, and the similarity can be obtained by calculating the distance between the two matrices. Alternatively, the simplified model data and the original model data can be converted into two-dimensional representations, and the similarity can be obtained by calculating the distance between the two two-dimensional images. Alternatively, the similarity can be obtained by extracting features from the original model data and the simplified model data and calculating the distance between the two features.
[0074] This step will be described in detail below.
[0075] S13, adjusting the initial simplification parameters according to the similarity to simplify the original model data again and determine the LOD data corresponding to the original model data.
[0076] The similarity is used to indicate the degree of similarity between the simplified model data and the original model data. As long as the similarity is within a certain threshold, the original model data can be further simplified by adjusting the initial simplification parameters. The purpose of further simplification is to further reduce the data volume of the simplified model data.
[0077] For example, for the simplification method, the smaller the simplification parameter, the lower the precision of the simplified model data. Therefore, when the similarity is within a certain threshold range, the simplification parameter can be increased to improve the precision of the simplified model data.
[0078] Each time the original model data is simplified, a level of LOD data is generated. For example, the original model data is considered to be the most refined LOD data, and its level is defined as L0. After the first simplification process, LOD data of level L1 is obtained. After the second simplification process, LOD data of level L2 is obtained. And so on, until LOD data of level Ln is determined, which meets the requirements and has the smallest data volume.
[0079] It should be noted that the method of distinguishing different levels is not limited to the L0-Ln method described above, and can also be other methods. There is no limitation on it here, and it can be set according to actual needs.
[0080] This step will be described in detail below.
[0081] The LOD data generation method provided in this embodiment adjusts the initial simplification parameters by the similarity between the original model data and the simplified model data, thereby realizing automatic adjustment of the initial simplification parameters. The automatic adjustment is performed based on the similarity, which is obtained by using the simplified model data and the original model data. The reliability of the automatically adjusted initial simplification parameters can be guaranteed on the basis of retaining the characteristics of the original model data to the greatest extent. At the same time, since the entire LOD data generation process is automatically processed and does not require human intervention, the efficiency of generating LOD data is improved.
[0082] In this embodiment, a method for generating LOD data is provided, which can be used in electronic devices such as computers, mobile phones, tablet computers, etc. Figure 4 : is a flow chart of a method for generating LOD data according to an embodiment of the present invention. Figure 4 As shown, the process includes the following steps:
[0083] S21, obtaining original model data and initial simplified parameters.
[0084] For details, please see Figure 2S11 of the illustrated embodiment will not be described in detail here.
[0085] S22, simplifying the original model data based on the initial simplified parameters to obtain simplified model data, and determining the similarity between the original model data and the simplified model data.
[0086] For details, please see Figure 2 S12 of the illustrated embodiment will not be described in detail here.
[0087] S23 , adjusting the initial simplification parameters according to the similarity to further simplify the original model data and determine LOD data corresponding to the original model data.
[0088] Specifically, the above S23 includes:
[0089] S231, obtaining an initial upper limit and an initial lower limit corresponding to the initial simplified parameter.
[0090] As described above, the number of parameters in the initial simplified parameters is determined based on the simplification method. For example, there are three simplified parameters in the initial simplified parameters. Each simplified parameter has an initial upper limit and an initial lower limit.
[0091] For example, to simplify parameter A, the corresponding value range is [a1, a2], the corresponding initial upper limit is a1, and the initial lower limit is a2;
[0092] Simplify the parameter B, the corresponding value range is [b1, b2], the corresponding initial upper limit is b1, and the initial lower limit is b2;
[0093] Simplify the parameter C, the corresponding value range is [c1, c2], the corresponding initial upper limit is c1, and the initial appearance is c2.
[0094] For each simplified parameter, the electronic device does not necessarily need to obtain its corresponding value range, and may only need to obtain the corresponding initial upper limit and lower limit, which may be specifically set according to actual needs.
[0095] S232 , based on the relationship between the similarity and the threshold, the initial simplified parameters are adjusted using the initial upper limit and the initial lower limit to obtain adjusted simplified parameters.
[0096] The specific value of the threshold is set according to actual needs. The electronic device compares the similarity with the threshold and determines the adjustment direction of each simplified parameter in the initial simplified parameters. Specifically, the initial simplified parameters are adjusted using the initial upper and lower limits to determine the adjusted simplified parameters.
[0097] In some optional implementations of this embodiment, the above S232 may include:
[0098] (1) Using the relationship between the similarity and the threshold, the initial upper limit and lower limit are adjusted to obtain the adjusted upper limit and lower limit.
[0099] The initial upper limit defines the direction limit where simplification is less obvious, and the initial lower limit defines the direction limit where simplification is more obvious. When the similarity is greater than the threshold, it means that a parameter closer to the lower limit can be used for simplification, that is, the initial upper limit is reduced to obtain an adjusted upper limit. For example, for simplification parameter A, the adjusted upper limit a2 = (a1 + a2) / 2; when the similarity is less than the threshold, it means that a parameter closer to the upper limit can be used for more conservative simplification, that is, the initial lower limit is increased to obtain an adjusted lower limit. For example, for simplification parameter A, the adjusted lower limit a1 = (a1 + a2) / 2.
[0100] When the similarity is greater than the threshold, it means that parameters closer to the lower limit can be used for simplification. When the similarity is less than the threshold, it means that parameters closer to the upper limit can be used for simplification. Based on this, the initial upper and lower limits are adjusted accordingly to meet the adjustment requirements.
[0101] (2) Based on the adjusted upper and lower limits, the initial simplified parameters are adjusted to obtain the adjusted simplified parameters.
[0102] After determining the adjusted upper and lower limits, the electronic device can calculate the adjusted simplified parameters in the following manner:
[0103] 2.1) Calculate the mean of the adjusted upper and lower limits.
[0104] 2.2) Determine the mean as the adjusted simplified parameter.
[0105] That is, the adjusted simplified parameters are obtained through bisection, and finally the global optimal solution that meets the conditions is obtained through iteration.
[0106] First, the initial upper and lower limits are adjusted using the relationship between the similarity and the threshold. Since the threshold is the expected value of the simplification, the initial simplification parameters are adjusted on this basis. This can reduce the number of adjustments to the initial simplification parameters and improve the efficiency of LOD data generation.
[0107] Alternatively, after determining the adjusted upper limit and lower limit, the electronic device may also determine a parameter value within the adjusted value range as the adjusted simplified parameter value.
[0108] Alternatively, the simplified adjustment parameter can be obtained using the following method. For the simplified parameter A, its initial upper limit is a1 and its initial lower limit is a2. The adjusted simplified parameter can be determined using an enumeration method. That is, the adjusted simplified parameter A = a2 + t(a1 - a2), where t = s, 2s, 3s, ..., ns, and ns = 1, and the minimum t value for each threshold condition is selected.
[0109] For example, the simplification parameter has only one parameter, which is the ratio of the number of triangles after simplification to the number of triangles before simplification, denoted as ratio. Then para = (ratio). Assume that the minimum value of ratio may be 0 and the maximum value may be 0.5. Then there is a parameter interval [(0.0), (0.5)]. Now, we want to find a ratio value that satisfies the threshold condition and the ratio is the smallest. Assume that this ratio that meets the requirements is within the interval. Take s = 0.1, n = 10. Then t = 0.1, 0.2, 0.3, ..., 0.9, 1.0. Then para = (0.05), (0.1), ..., (0.45), (0.5). Use para to calculate whether the threshold condition is met in sequence. Assuming that when para = (0.35) does not meet the threshold condition, and para = (0.40) meets the threshold condition, then take para = (0.40), that is, ratio = 0.40.
[0110] Alternatively, the initial simplified parameters may be adjusted in other ways, and specific settings may be made according to actual needs.
[0111] S233: Simplify the original model data again using the adjusted simplification parameters to determine LOD data corresponding to the original model data.
[0112] After obtaining the adjusted simplified parameters, the electronic device uses them to simplify the original model data again, specifically by adopting the simplification method described in S22, and finally determines the LOD data corresponding to the original model data.
[0113] In the LOD data generation method provided in this embodiment, the threshold represents the expected value of simplification, and the adjustment direction of the initial simplification parameters is guided by the size relationship between the similarity and the threshold. That is, the initial simplification parameters are adjusted through the initial upper and lower limits, thereby ensuring the accuracy of the adjusted simplification parameters, and dynamically obtaining LOD data that meets the threshold requirements and is optimal in terms of data volume. In addition, the LOD level generation process is automatic and does not require human intervention, thereby improving the level of automation. Obtaining data also improves loading speed and interactive experience.
[0114] As an optional implementation of this embodiment, after adjusting the initial upper limit and lower limit, the electronic device can first determine whether the size of the parameter interval converges to a specific range of values, thereby determining whether the simplification process is completed. Specifically, the above S233 may include:
[0115] (1) Determine whether the difference between the adjusted upper limit and lower limit meets the stop condition.
[0116] For example, if the stopping condition is D, for the simplified parameter A, calculate the difference between the adjusted upper limit and the adjusted lower limit, determine the value range, and determine whether the value range is smaller than the stopping condition. If the stopping condition is met, the process ends and the current simplified result is selected as the LOD data that meets the condition and has the smallest data volume. Otherwise, execute step (2).
[0117] (2) When the stopping condition is not met, the initial simplified parameters are adjusted using the adjusted upper and lower limits to obtain the adjusted simplified parameters.
[0118] That is, the adjusted simplified parameters are obtained by adopting the method described in step (2) in the optional implementation manner in the above S232.
[0119] (3) The original model data is simplified again using the adjusted simplified parameters to determine the LOD data corresponding to the original model data.
[0120] For details, please refer to the simplified method described in S22 and will not be repeated here.
[0121] Since the interval between the upper and lower limits represents the adjustable range of the simplified parameters, when the adjustable range is small, it is meaningless to simplify the model. Therefore, the relationship between the difference between the adjusted upper and lower limits and the stopping condition is used to determine whether to continue simplification, thereby reducing invalid model simplification and improving the efficiency of LOD data generation.
[0122] In this embodiment, a method for generating LOD data is provided, which can be used in electronic devices such as computers, mobile phones, tablet computers, etc. Figure 5 : is a flow chart of a method for generating LOD data according to an embodiment of the present invention. Figure 5 As shown, the process includes the following steps:
[0123] S31, obtaining original model data and initial simplified parameters.
[0124] For details, please see Figure 2 S11 of the illustrated embodiment will not be described in detail here.
[0125] S32, simplifying the original model data based on the initial simplification parameters to obtain simplified model data, and determining the similarity between the original model data and the simplified model data.
[0126] Specifically, the above S32 includes:
[0127] S321, simplifying the original model data using the initial simplified parameters to obtain simplified model data.
[0128] For details, please refer to the simplified method described in S22 and will not be repeated here.
[0129] S322 , converting the original model data and the simplified model data into two-dimensional representations respectively to obtain an original data image and a simplified data image.
[0130] Since both the original model data and the simplified model data are 3D, the electronic device converts them into 2D representations to reduce data processing, resulting in the original and simplified data images. The 2D representations can be generated from angles selected from left, front, right, back, up, down, or diagonal, or other specified directions, or from multiple angles.
[0131] There is no limitation on the specific method of converting a three-dimensional model into two-dimensional representation, and the method can be selected according to actual needs.
[0132] S323 , determining similarity based on the features of the original data image and the features of the simplified data image.
[0133] After obtaining the two-dimensional representation of the original data image and the simplified data image, the electronic device extracts features from each of them and calculates similarity using the extracted features. Feature extraction can be implemented using a feature extraction network or image processing to extract contour lines or pixel colors from the original data image, and similarity can be calculated using at least one of these two methods.
[0134] For example, a similarity cs based on contour lines and a similarity ps based on pixel colors may be calculated, and then the two similarities are compared with corresponding thresholds to determine the adjusted simplification parameters.
[0135] S33 , adjusting the initial simplification parameters according to the similarity to further simplify the original model data and determine the LOD data corresponding to the original model data.
[0136] For details, please see Figure 4 S23 of the illustrated embodiment will not be described in detail here.
[0137] The LOD data generation method provided in this embodiment calculates similarity based on a two-dimensional image of the three-dimensional model, rather than directly calculating it using the three-dimensional model. Processing using two-dimensional images is faster because the unit of calculation for two-dimensional image similarity is pixels, and the amount of calculation required may be only tens of thousands to hundreds of thousands. In contrast, calculations based on three-dimensional models use the number of triangles or vertices, which may be tens of millions or more. It is more intuitive: placing two images together makes it easy to see the effect, while three-dimensional models must be displayed in three-dimensional space. It is easier to process material information: after generating an image, the model's geometric and material information can be simultaneously reflected, while most comparison algorithms based on three-dimensional models focus only on geometric information. Furthermore, it is more realistic: when a three-dimensional model is displayed on a screen, it has already collapsed into two dimensions. Therefore, when a person subjectively judges whether two models are similar, they are already making a judgment based on the two-dimensional image.
[0138] In a specific application example of this embodiment, Figure 6 As shown, the method for generating LOD data includes:
[0139] (1) Obtain original model data.
[0140] (2) Use the initial simplified parameters to simplify the original model data to obtain LOD data.
[0141] (3) The original model data and LOD data are respectively represented in two dimensions, that is, corresponding thumbnails are generated to obtain the original data image and the simplified data image.
[0142] Among them, when generating the corresponding thumbnail, the camera distance needs to be considered.
[0143] (4) Calculate the similarity between the original data image and the simplified data image to obtain the data comparison result.
[0144] Specifically, under specific camera and display parameters, we calculate the similarity (cs) based on contour lines and the similarity (ps) based on pixel colors. The similarity is based on the original data value of 1.0, with values closer to 1.0 indicating greater similarity and values closer to 0 indicating less similarity.
[0145] (5) Adjust the simplified parameters based on the data comparison results.
[0146] Compare the obtained data comparison results with the pre-set threshold and determine the new simplification parameters. Here, the binary method is used. Assume that the parameters used by the simplification algorithm are para1, para2, para3, ..., para n , we can get the parameter vector para=(para1,para2,para3,…,para nFor example, the simplification parameter is used and only one is used, that is, the ratio of the number of triangles after simplification to the number of triangles before simplification, which is recorded as ratio. The corresponding parameter vector para = (ratio). When the ratio value is small, the simplification effect is more obvious and the amount of data is greatly reduced; when the ratio value is large, the simplification effect is less obvious and the data is close to the original data. Assume that there is a relatively small ratio value ratio s and a relatively large ratio value l , corresponding to para s =(ratio s ), para l =(ratio l ), then the parameter interval [para s ,para l ]. Among them, the lower bound of the interval para s Defines the simplified obvious direction limit, the upper bound of the interval para l Defines the direction boundary where simplification is not obvious. When the simplified result meets the threshold condition, that is, cs>cs th ,ps>ps th , it means that you can use a closer para s The parameters of the simplification are updated l =(para s +para l ) / 2; On the contrary, when the simplified result does not meet the threshold condition, that is, cs <cs th or ps <ps th , it means that a closer para l The parameters of the parameter are simplified more conservatively, and the update para s =(para s +para l ) / 2. The above threshold judgment conditions can also be modified according to needs.
[0147] For example, if the simplified parameters only have one parameter, ratio, then para = (ratio). Assume that the minimum value of ratio may be 0.01 and the maximum value may be 1.0. Then there is a parameter interval [(0.01),(1.0)]. Now, we want to find a ratio value that satisfies the threshold condition and minimizes the ratio. Assume that this ratio that meets the requirements is within the interval. First, calculate para = ((0.01) + (1.0)) / 2 = (0.505). If the threshold condition is met, then this ratio must be within the interval [(0.01),(0.505)]. Then, calculate para = ((0.01) + (0.505)) / 2 = 0.2575. If the threshold condition is not met, then the ratio must be within the interval [(0.2575),(0.505)]. Repeat this process multiple times until the upper and lower bounds of the interval are very close, and you can get the ratio.
[0148] (6) Determine whether the simplified parameters have converged to a certain extent. If so, the process stops; if not, return to step (2) and continue to simplify the original model data using the adjusted simplified parameters.
[0149] When the size of the parameter interval converges to a specific value, that is, |para l -para s |<|para th |, the process ends and the current simplified result is selected as the final result; otherwise, use (para s +para l ) / 2 as the simplified parameter and re-execute step (2).
[0150] In this embodiment, a device for generating LOD data is also provided, which is used to implement the above-mentioned embodiments and preferred embodiments. Details that have already been described will not be repeated here. As used below, the term "module" may refer to a combination of software and / or hardware that implements a predetermined function. Although the devices described in the following embodiments are preferably implemented in software, implementation using hardware, or a combination of software and hardware, is also possible and contemplated.
[0151] This embodiment provides a device for generating LOD data, such as Figure 7 Shown, including:
[0152] An acquisition module 41 is used to acquire original model data and initial simplified parameters;
[0153] a simplification module 42, configured to simplify the original model data based on the initial simplification parameters to obtain simplified model data, and determine a similarity between the original model data and the simplified model data;
[0154] The adjustment module 43 is configured to adjust the initial simplification parameters according to the similarity, so as to further simplify the original model data and determine the LOD data corresponding to the original model data.
[0155] The LOD data generation device provided in this embodiment adjusts the initial simplification parameters by the similarity between the original model data and the simplified model data, thereby realizing automatic adjustment of the initial simplification parameters. The automatic adjustment is performed based on the similarity, which is obtained by using the simplified model data and the original model data. The reliability of the automatically adjusted initial simplification parameters can be guaranteed on the basis of retaining the characteristics of the original model data to the greatest extent. At the same time, since the entire LOD data generation process is automatically processed and does not require human intervention, the efficiency of generating LOD data is improved.
[0156] The LOD data generation device in this embodiment is presented in the form of a functional unit, where the unit refers to an ASIC circuit, a processor and memory that executes one or more software or fixed programs, and / or other devices that can provide the above functions.
[0157] The further functional description of each of the above modules is the same as that of the above corresponding embodiments and will not be repeated here.
[0158] An embodiment of the present invention further provides an electronic device having the above Figure 7 The LOD data generation device shown.
[0159] See also Figure 8 , Figure 8 is a structural diagram of an electronic device provided by an optional embodiment of the present invention, such as Figure 8 As shown, the electronic device may include: at least one processor 51, such as a CPU (Central Processing Unit), at least one communication interface 53, a memory 54, and at least one communication bus 52. The communication bus 52 is used to realize the connection and communication between these components. The communication interface 53 may include a display screen (Display), a keyboard (Keyboard), and the optional communication interface 53 may also include a standard wired interface and a wireless interface. The memory 54 may be a high-speed RAM memory (Random Access Memory, volatile random access memory) or a non-volatile memory (non-volatile memory), such as at least one disk memory. The memory 54 may optionally be at least one storage device located away from the aforementioned processor 51. The processor 51 may be combined with Figure 7In the described apparatus, the memory 54 stores an application program, and the processor 51 calls the program code stored in the memory 54 to execute any of the above method steps.
[0160] The communication bus 52 may be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus. The communication bus 52 may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 8 Only one thick line is used in the diagram, but this does not mean that there is only one bus or one type of bus.
[0161] Among them, the memory 54 may include volatile memory (English: volatile memory), such as random-access memory (English: random-access memory, abbreviated: RAM); the memory may also include non-volatile memory (English: non-volatile memory), such as flash memory (English: flash memory), hard disk drive (English: hard disk drive, abbreviated: HDD) or solid-state drive (English: solid-state drive, abbreviated: SSD); the memory 54 may also include a combination of the above types of memory.
[0162] The processor 51 may be a central processing unit (CPU), a network processor (NP), or a combination of a CPU and a NP.
[0163] The processor 51 may further include a hardware chip. The hardware chip may be an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. The PLD may be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof.
[0164] Optionally, the memory 54 is also used to store program instructions. The processor 51 can call the program instructions to implement the present application. Figure 2 or Figure 4-6 The method for generating LOD data shown in any embodiment.
[0165] An embodiment of the present invention further provides a non-transitory computer storage medium storing computer-executable instructions that can execute the method for generating LOD data in any of the above-mentioned method embodiments. The storage medium can be a magnetic disk, an optical disk, a read-only memory (ROM), a random access memory (RAM), a flash memory, a hard disk drive (HDD), or a solid-state drive (SSD); the storage medium can also include a combination of the above-mentioned types of memory.
[0166] Although the embodiments of the present invention have been described with reference to the accompanying drawings, those skilled in the art may make various modifications and variations without departing from the spirit and scope of the present invention. Such modifications and variations are all within the scope defined by the appended claims.
Claims
1. A method for generating LOD data, characterized in that: include: Obtain original model data and initial simplified parameters; Simplifying the original model data based on the initial simplification parameters to obtain simplified model data, and determining the similarity between the original model data and the simplified model data; Adjusting the initial simplification parameters according to the similarity to further simplify the original model data and determine LOD data corresponding to the original model data; The adjusting of the initial simplification parameters according to the similarity to further simplify the original model data and determine the LOD data corresponding to the original model data includes: Obtaining an initial upper limit and an initial lower limit corresponding to the initial simplified parameter; Based on the relationship between the similarity and the threshold, adjusting the initial simplified parameter using the initial upper limit and the initial lower limit to obtain an adjusted simplified parameter; The original model data is simplified again using the adjusted simplification parameters to determine LOD data corresponding to the original model data.
2. The method according to claim 1, characterized in that The adjusting the initial simplified parameter based on the relationship between the similarity and the threshold using the initial upper limit and the initial lower limit to obtain the adjusted simplified parameter includes: Using the relationship between the similarity and the threshold, the initial upper limit and the initial lower limit are adjusted to obtain an adjusted upper limit and lower limit; Based on the adjusted upper limit and lower limit, the initial simplified parameter is adjusted to obtain an adjusted simplified parameter.
3. The method according to claim 2, characterized in that The adjusting the initial upper limit and the initial lower limit by using the relationship between the similarity and the threshold to obtain the adjusted upper limit and the lower limit includes: When the similarity is less than the threshold, increasing the initial lower limit to obtain an adjusted lower limit; When the similarity is greater than the threshold, the initial upper limit is reduced to obtain an adjusted upper limit.
4. The method according to claim 2 or 3, characterized in that The adjusting the initial simplified parameter based on the adjusted upper limit and lower limit to obtain the adjusted simplified parameter includes: Calculating the mean of the adjusted upper and lower limits; The mean value is determined as the adjusted simplified parameter.
5. The method according to claim 1, wherein The further simplifying of the original model data by using the adjusted simplification parameters to determine LOD data corresponding to the original model data includes: Determining whether the difference between the adjusted upper limit and lower limit meets a stop condition; When the stop condition is not met, adjusting the initial simplified parameter using the adjusted upper limit and lower limit to obtain the adjusted simplified parameter; The original model data is simplified again using the adjusted simplification parameters to determine LOD data corresponding to the original model data.
6. The method according to claim 1, characterized in that The simplification of the original model data based on the initial simplification parameters to obtain simplified model data, and determining the similarity between the original model data and the simplified model data, includes: Simplifying the original model data using the initial simplified parameters to obtain simplified model data; Converting the original model data and the simplified model data into two-dimensional representations respectively to obtain an original data image and a simplified data image; The similarity is determined based on the features of the original data image and the features of the simplified data image.
7. A device for generating LOD data, characterized in that: include: An acquisition module is used to obtain original model data and initial simplified parameters; a simplification module, configured to simplify the original model data based on the initial simplification parameters to obtain simplified model data, and determine a similarity between the original model data and the simplified model data; an adjustment module, configured to adjust the initial simplification parameters according to the similarity, so as to further simplify the original model data and determine LOD data corresponding to the original model data; The adjusting of the initial simplification parameters according to the similarity to further simplify the original model data and determine the LOD data corresponding to the original model data includes: Obtaining an initial upper limit and an initial lower limit corresponding to the initial simplified parameter; Based on the relationship between the similarity and the threshold, adjusting the initial simplified parameter using the initial upper limit and the initial lower limit to obtain an adjusted simplified parameter; The original model data is simplified again using the adjusted simplification parameters to determine LOD data corresponding to the original model data.
8. An electronic device, characterized in that: include: A memory and a processor, wherein the memory and the processor are communicatively connected to each other, the memory stores computer instructions, and the processor executes the LOD data generation method according to any one of claims 1 to 6 by executing the computer instructions.
9. A computer-readable storage medium, characterized in that The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the method for generating LOD data according to any one of claims 1 to 6.
Citation Information
Patent Citations
KR1018111350000B1