A method and system for making and generating multi-level three-dimensional grid files

By using a three-dimensional grid file of any name and dynamically debugging the surface reduction ratio, the problems of cumbersome production and generation of three-dimensional grids in the existing technology are solved, and the effects of simplifying the process, improving flexibility and convenient debugging are achieved.

CN118152345BActive Publication Date: 2025-05-13SHENZHEN AIDIP INFORMATION TECHNOLOGY CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410088737.7
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-01-22
Publication Date
2025-05-13
Estimated Expiration
2044-01-22

AI Technical Summary

Technical Problem

In the prior art, the three-dimensional grid production and generation process is cumbersome, poor flexibility and difficult to debug. Especially when exporting multiple three-dimensional grid files using DCC software, strict naming specifications need to be followed, resulting in cumbersome processing steps and difficult to debug.

Method used

By using a three-dimensional grid file of any name and dynamically debugging and serializing the surface reduction ratios corresponding to grids of each grid level in the three-dimensional grid, a three-dimensional grid file with composite requirements is generated. Grid data and material data can be referenced between different levels. The rendering window can only display a certain level of model or all models through setting.

Benefits of technology

The process of making and generating multi-level three-dimensional grid files is simplified, and the flexibility of making and generating multi-level three-dimensional grid files is improved, as well as the convenience of debugging, avoiding dependence on the three-dimensional grid file name specifications.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118152345B_ABST
    Figure CN118152345B_ABST
Patent Text Reader

Abstract

The present invention discloses a method and system for making and generating a multi-level three-dimensional mesh file, the method comprising: setting empty elements according to the number of mesh levels of a three-dimensional mesh and the empty element data structure; receiving and parsing a user's three-dimensional mesh file making request, and obtaining source data, face reduction ratio, display threshold and material parameters corresponding to the three-dimensional mesh file making request according to the parsing result and the mesh level of the three-dimensional mesh; based on the source data and the empty elements, according to the display effect of the three-dimensional mesh, determining the optimal face reduction ratio, display threshold and material parameters corresponding to the meshes of each mesh level in the three-dimensional mesh, and generating mesh data; serializing the mesh data, generating a three-dimensional mesh file and storing it. By applying the method and system provided by the present invention, the process for making and generating a multi-level three-dimensional mesh file is simplified, the flexibility and the convenience of debugging are improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of three-dimensional model production and presentation, and more specifically, to a method and system for producing and generating a multi-level three-dimensional grid file. Background Art

[0002] In actual 3D model application scenarios, rendering a 3D mesh containing a large number of triangles will occupy and consume a lot of GPU resources. Therefore, multi-level detail processing technology is required to dynamically adjust the number of triangles that need to be rendered in the 3D mesh according to the distance between the camera and the 3D mesh, thereby achieving the purpose of reducing GPU resource usage and increasing the rendering frame rate.

[0003] In the prior art, to produce a 3D mesh with multi-level detail information, it is usually necessary to use DCC software (digital content creation software) to export multiple 3D mesh files, and to make certain specifications in the naming of the 3D mesh files, and to merge these 3D meshes into groups in the rendering software to achieve the multi-level detail rendering function. However, using DCC software to produce multiple 3D mesh files and complying with the naming specifications when saving the files makes this method have the defects of cumbersome processing steps, poor flexibility and difficulty in debugging.

[0004] In view of the defects of the above-mentioned prior art, it is necessary to introduce a new method and system, which uses an existing 3D model file with any name or determines the mesh data that needs to be displayed at a certain level by reducing the surface. The mesh data and material data can be referenced by each other between different levels. At the same time, the rendering window can be set to display only a certain level of model or all models, so as to solve the technical problems of cumbersome production and generation of 3D meshes, poor flexibility and difficulty in debugging in the prior art, thereby simplifying the process of production and generation of multi-level 3D mesh files, improving the flexibility of the production process and generation of multi-level 3D mesh files, and the convenience of debugging. Summary of the invention

[0005] In response to the technical problems mentioned above, the present invention provides a method and system for producing and generating a multi-level three-dimensional mesh file, by using a three-dimensional mesh file with an arbitrary name, and dynamically debugging and serializing the surface reduction ratios corresponding to the meshes of each mesh level in the three-dimensional mesh, and generating and storing a three-dimensional mesh file with complex requirements according to the processing and debugging results, so as to solve the technical problems of cumbersome production and generation of three-dimensional meshes, poor flexibility and difficulty in debugging in the prior art, so that the production of three-dimensional mesh files is no longer restricted by the name specifications of the three-dimensional mesh files, and the mesh data that needs to be displayed at any level in the three-dimensional mesh can be determined by using an existing three-dimensional model file with an arbitrary name and by reducing the surface, and the mesh data and material data can be referenced by each other between different levels, and the rendering window can be set to display only a certain level of model or all models, thereby simplifying the process of producing and generating multi-level three-dimensional mesh files, improving the flexibility of the production process and generation of multi-level three-dimensional mesh files, and the convenience of debugging.

[0006] The present invention provides a method for producing and generating a multi-level three-dimensional grid file, the method comprising:

[0007] S101, generating empty elements corresponding to the number of grid levels and the empty element data structure of the three-dimensional grid; S102, receiving and parsing the user's three-dimensional grid file creation request, and obtaining the source data, face reduction ratio, display threshold and material parameters corresponding to the three-dimensional grid file creation request according to the parsing result and the grid level of the three-dimensional grid; S103, based on the source data and the empty elements, determining the optimal face reduction ratio, display threshold and material parameters corresponding to the grids of each grid level in the three-dimensional grid according to the display effect of the three-dimensional grid, and generating grid data; S104, serializing the grid data, generating a three-dimensional grid file and storing it.

[0008] Preferably, in step S101, the step of generating empty elements corresponding to the number of grid levels of the three-dimensional grid and the empty element data structure further includes: defining and constructing the structure of each of the empty elements according to the empty element data structure, and determining the relationship between display data, source data and surface reduction ratio; obtaining the number of grid levels of the three-dimensional grid set by the user, and generating the empty elements equal to the number of grid levels of the three-dimensional grid according to the number of grid levels of the three-dimensional grid; wherein the empty element data structure includes: three-dimensional grid, grid level, source data, display data, surface reduction ratio, display threshold and material parameters; the relationship between the display data, source data and surface reduction ratio is: display data = source data × surface reduction ratio × 100%.

[0009] Preferably, in step S102, the step of respectively acquiring source data, face reduction ratio, display threshold and material parameters corresponding to the three-dimensional mesh file creation request according to the parsing result and the mesh level of the three-dimensional mesh comprises: S3-1, real-time monitoring of the three-dimensional mesh file creation event, and acquiring and parsing the three-dimensional mesh file creation request according to the triggering result of the three-dimensional mesh file creation event, and determining the current three-dimensional mesh and mesh level in the three-dimensional mesh corresponding to the three-dimensional mesh file creation request; S3-2, acquiring source data, face reduction ratio, display threshold and material parameters of the current three-dimensional mesh according to the parsing result, storing the source data in the memory and generating a corresponding storage path; S3-3, according to Based on the source data and the face reduction ratio, and the relationship between the display data, the source data and the face reduction ratio, determine the display data of the current three-dimensional grid; S3-4, calculate and obtain the ratio of the bounding box of the current three-dimensional grid to the entire rendering screen of the three-dimensional grid according to the display threshold, and render and display the display data of the current three-dimensional grid according to the ratio; S3-5, determine the mesh material of the current three-dimensional grid according to the mesh level of the current three-dimensional grid and the material parameters; S3-6, repeat steps S3-2, S3-3, S3-4 and S3-5 until the source data, face reduction ratio, display threshold and material parameters, as well as the display data and mesh material of all the three-dimensional grids are obtained and determined.

[0010] Preferably, in step S3-2, the source data of the current three-dimensional grid is determined according to the type of three-dimensional object displayed by the user, and there are two ways to obtain the source data of the current three-dimensional grid, namely external import and other level grid acquisition; when the acquisition method is external import, the external source data file is imported through the storage path corresponding to the three-dimensional grid file production request, and the source data of the current three-dimensional grid is extracted according to the external source data file and stored in the memory; when the acquisition method is other level grid acquisition, the corresponding source data is read from the memory according to the grid level of the other level grid, and the storage path of the current three-dimensional grid stores the read source data in the memory.

[0011] Preferably, in step S3-3, the face reduction ratio is determined according to the model face reduction effect displayed in the rendering window after the three-dimensional mesh is rendered, and three-dimensional meshes of different mesh levels correspond to different face reduction ratios; the display data of the current three-dimensional mesh = the source data × the face reduction ratio × 100%.

[0012] Preferably, in step S3-4, the step of calculating and obtaining the ratio value of the bounding box of the current three-dimensional grid to the entire rendering screen of the three-dimensional grid according to the display threshold further includes: obtaining the view matrix ViewM and the projection matrix PJM of the camera corresponding to the three-dimensional grid, and the bounding box C3DM of the current three-dimensional grid; calculating the ratio value KM of the bounding box of the current three-dimensional grid to the entire rendering screen of the three-dimensional grid according to the view matrix and the projection matrix, and the bounding box of the current three-dimensional grid; displaying the display data of the current three-dimensional grid according to the ratio value KM and the display threshold, and displaying the display data of the current three-dimensional grid when the ratio value KM is equal to or greater than the display threshold; wherein,

[0013]

[0014] Preferably, in step S3-5, the step of determining the mesh material of the current three-dimensional mesh based on the mesh level of the current three-dimensional mesh and the material parameters further includes: determining the distance of the current three-dimensional mesh from the camera and the display level of the current three-dimensional mesh based on the mesh level of the current three-dimensional mesh; determining the pixels and mesh material of the map used to render the current three-dimensional mesh based on the display level and the material parameters; wherein the display level is inversely proportional to the distance of the current three-dimensional mesh from the camera, and directly proportional to the pixels and mesh material of the map rendered by the current three-dimensional mesh.

[0015] Preferably, the step of determining the optimal face reduction ratio, display threshold and material parameters corresponding to each mesh level in the three-dimensional mesh based on the source data and the empty element and according to the display effect of the three-dimensional mesh, and generating mesh data in S103 further comprises: S8-1, rendering the three-dimensional mesh of each mesh level respectively based on the source data, face reduction ratio, display threshold and material parameters of the three-dimensional mesh, as well as the display data and mesh material of the three-dimensional mesh; S8-2, adjusting the distance between the current three-dimensional mesh and the camera, and calculating the current three-dimensional mesh according to the view matrix and the projection matrix, as well as the bounding box of the current three-dimensional mesh; The ratio KM of the bounding box of the three-dimensional grid to the entire rendering screen of the three-dimensional grid; S8-3, recording the face reduction ratio, material parameters, display data and grid parameters when the ratio KM is close to the display threshold, as the optimal face reduction ratio, display threshold and material parameters, and generating grid data corresponding to the current three-dimensional grid, and displaying the current three-dimensional grid; S8-4, repeating steps S8-2 and S8-3 until the optimal face reduction ratio, display threshold and material parameters, and grid data of all three-dimensional grids are determined, and all grid data are respectively corresponded to the corresponding empty elements according to the grid level of the three-dimensional grid.

[0016] Preferably, the step of serializing the grid data to generate and store a three-dimensional grid file in S104 also includes: serializing and converting the display data and display threshold corresponding to the three-dimensional grid of each grid level stored in the empty element according to the grid level of the three-dimensional grid to generate a corresponding binary file; and storing the binary files corresponding to the three-dimensional grid of each grid level according to the grid level of the three-dimensional grid.

[0017] Accordingly, the present invention also provides a system for making and generating a multi-level three-dimensional mesh file, the system comprising a three-dimensional mesh initialization module, a mesh data processing module, a three-dimensional mesh generation module and a mesh file storage module; wherein,

[0018] The three-dimensional grid initialization module is used to generate empty elements corresponding to the number of grid levels according to the number of grid levels of the three-dimensional grid and the empty element data structure;

[0019] The mesh data processing module is used to receive and analyze the user's three-dimensional mesh file creation request, and obtain source data, face reduction ratio, display threshold and material parameters corresponding to the three-dimensional mesh file creation request according to the analysis result and the mesh level of the three-dimensional mesh;

[0020] The three-dimensional mesh generation module is used to determine the optimal face reduction ratio, display threshold and material parameters corresponding to meshes of each mesh level in the three-dimensional mesh based on the source data and the empty element and according to the display effect of the three-dimensional mesh, and generate mesh data;

[0021] The grid file storage module is used to serialize the grid data, generate a three-dimensional grid file and store it.

[0022] By applying the above technical scheme, the present invention realizes the use of 3D mesh files with arbitrary names, and dynamically and separately debugs and serializes the surface reduction ratios corresponding to meshes of each mesh level in the 3D mesh, and generates and stores 3D mesh files with complex requirements according to the processing and debugging results, thereby solving the technical problems of cumbersome 3D mesh production and generation, poor flexibility and difficulty in debugging in the prior art, so that the production of 3D mesh files is no longer restricted by the name specifications of 3D mesh files, and the mesh data that needs to be displayed at any level in the 3D mesh can be determined by using an existing 3D model file with arbitrary name in a surface reduction manner, and mesh data and material data can be referenced to each other between different levels, and the rendering window can be set to display only a certain level of model or all models, thereby simplifying the process, improving flexibility and convenience of debugging for the production and generation of multi-level 3D mesh files. BRIEF DESCRIPTION OF THE DRAWINGS

[0023] In order to more clearly illustrate the technical solutions in the embodiments of the present application, the drawings required for use in the description of the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For those skilled in the art, other drawings can be obtained based on these drawings without creative work.

[0024] Figure 1 A schematic flow chart of a method for producing and generating a multi-level three-dimensional grid file according to an embodiment of the present invention is shown;

[0025] Figure 2 A schematic diagram showing a process of parameter setting for making and generating a multi-level 3D mesh file according to an embodiment of the present invention

[0026] Figure 3 A schematic diagram of the structure of a system for producing and generating a multi-level three-dimensional grid file proposed in an embodiment of the present invention is shown. DETAILED DESCRIPTION

[0027] The following will be combined with the drawings in the embodiments of the present application to clearly and completely describe the technical solutions in the embodiments of the present application. Obviously, the described embodiments are only part of the embodiments of the present application, not all of the embodiments. Based on the embodiments in the present application, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of this application.

[0028] The present invention provides a method for producing and generating a multi-level three-dimensional grid file. Figure 1 As shown, the method comprises the following steps:

[0029] S101, generating empty elements corresponding to the number of grid levels of a three-dimensional grid and a data structure of empty elements.

[0030] In this embodiment, in step S101, the step of generating empty elements corresponding to the number of grid levels of the three-dimensional grid and the empty element data structure further includes:

[0031] According to the empty element data structure, define and construct the structure of each of the empty elements, and determine the relationship between display data, source data and face reduction ratio;

[0032] Acquire the number of grid levels of the three-dimensional grid set by the user, and generate the empty elements equal to the number of grid levels of the three-dimensional grid according to the number of grid levels of the three-dimensional grid;

[0033] in,

[0034] The empty element data structure includes: a three-dimensional grid, a grid level, source data, display data, a face reduction ratio, a display threshold, and material parameters;

[0035] The relationship among the display data, source data and face reduction ratio is:

[0036] Display data = source data × reduction ratio × 100%.

[0037] S102, receiving and parsing a user's request for making a three-dimensional mesh file, and acquiring source data, a face reduction ratio, a display threshold, and material parameters corresponding to the request for making a three-dimensional mesh file according to the parsing result and the mesh level of the three-dimensional mesh.

[0038] In this embodiment, in step S102, the step of respectively acquiring source data, face reduction ratio, display threshold and material parameters corresponding to the three-dimensional mesh file creation request according to the parsing result and the mesh level of the three-dimensional mesh includes:

[0039] S3-1, monitoring a 3D mesh file creation event in real time, and according to a trigger result of the 3D mesh file creation event, obtaining and parsing the 3D mesh file creation request, and determining a current 3D mesh and a mesh level in the 3D mesh corresponding to the 3D mesh file creation request;

[0040] S3-2, according to the analysis result, obtaining the source data, face reduction ratio, display threshold and material parameters of the current three-dimensional mesh, storing the source data in a memory and generating a corresponding storage path;

[0041] S3-3, determining display data of the current three-dimensional grid based on the source data and the face reduction ratio, and a relationship among the display data, the source data, and the face reduction ratio;

[0042] S3-4, calculating and obtaining a ratio value of the enclosing frame of the current three-dimensional grid to the entire rendering screen of the three-dimensional grid according to the display threshold, and rendering and displaying the display data of the current three-dimensional grid according to the ratio value;

[0043] S3-5, determining the mesh material of the current three-dimensional mesh according to the mesh level of the current three-dimensional mesh and the material parameters;

[0044] S3-6, repeating steps S3-2, S3-3, S3-4 and S3-5 until the source data, face reduction ratio, display threshold and material parameters, as well as display data and mesh material of all the three-dimensional meshes are acquired and determined.

[0045] In this embodiment, in step S3-2, the source data of the current three-dimensional grid is determined according to the type of the three-dimensional object displayed by the user, and there are two ways to obtain the source data of the current three-dimensional grid, namely external import and other level grid acquisition;

[0046] When the acquisition method is external import, an external source data file is imported through a storage path corresponding to the three-dimensional mesh file production request, and source data of the current three-dimensional mesh is extracted according to the external source data file and stored in a memory;

[0047] When the acquisition path is other level grid acquisition, the corresponding source data is read from the memory according to the grid level of the other level grid, and the storage path of the current three-dimensional grid stores the read source data in the memory.

[0048] In this embodiment, in step S3-3, the face reduction ratio is determined according to the model face reduction effect displayed in the rendering window after the three-dimensional mesh is rendered, and three-dimensional meshes of different mesh levels correspond to different face reduction ratios;

[0049] The display data of the current three-dimensional grid=the source data×the face reduction ratio×100%.

[0050] In this embodiment, in step S3-4, the step of calculating and obtaining the ratio of the bounding box of the current three-dimensional grid to the entire rendering screen of the three-dimensional grid according to the display threshold further includes:

[0051] Obtain the view matrix ViewM and projection matrix PJM of the camera corresponding to the three-dimensional grid, as well as the bounding box C3DM of the current three-dimensional grid;

[0052] Calculate a ratio KM of the bounding box of the current three-dimensional grid to the entire rendering image of the three-dimensional grid according to the view matrix and the projection matrix and the bounding box of the current three-dimensional grid;

[0053] Displaying the display data of the current three-dimensional grid according to the ratio value KM and the display threshold, and displaying the display data of the current three-dimensional grid when the ratio value KM is equal to or greater than the display threshold;

[0054] in,

[0055]

[0056] In this embodiment, in step S3-5, the step of determining the mesh material of the current three-dimensional mesh according to the mesh level of the current three-dimensional mesh and the material parameter further includes:

[0057] Determining the distance of the current three-dimensional grid from the camera and the display level of the current three-dimensional grid according to the grid level of the current three-dimensional grid;

[0058] Determining pixels and mesh materials of a texture used for rendering the current three-dimensional mesh according to the display level and the material parameters;

[0059] in,

[0060] The display level is inversely proportional to the distance of the current three-dimensional grid from the camera, and is directly proportional to the pixels of the texture rendered by the current three-dimensional grid and the grid material.

[0061] S103, based on the source data and the empty elements, and according to the display effect of the three-dimensional grid, determining the optimal face reduction ratio, display threshold and material parameters corresponding to the grids of each grid level in the three-dimensional grid, and generating grid data.

[0062] In this embodiment, the step of determining the optimal face reduction ratio, display threshold and material parameters corresponding to meshes of each mesh level in the three-dimensional mesh based on the source data and the empty element according to the display effect of the three-dimensional mesh, and generating mesh data in S103 further includes:

[0063] S8-1, rendering the three-dimensional mesh of each mesh level respectively based on the source data, the face reduction ratio, the display threshold and the material parameter of the three-dimensional mesh, as well as the display data and the mesh material;

[0064] S8-2, adjusting the distance between the current three-dimensional grid and the camera, and calculating the ratio KM of the bounding box of the current three-dimensional grid to the entire rendering image of the three-dimensional grid according to the view matrix and the projection matrix and the bounding box of the current three-dimensional grid;

[0065] S8-3, recording the face reduction ratio, material parameters, display data and mesh parameters when the ratio value KM is close to the display threshold as the optimal face reduction ratio, display threshold and material parameters, generating mesh data corresponding to the current three-dimensional mesh, and displaying the current three-dimensional mesh;

[0066] S8-4, repeat steps S8-2 and S8-3 until the optimal face reduction ratio, display threshold and material parameters, as well as mesh data of all three-dimensional meshes are determined, and all mesh data are mapped to the corresponding empty elements according to the mesh levels of the three-dimensional meshes.

[0067] S104, serializing the mesh data to generate and store a three-dimensional mesh file.

[0068] In this embodiment, the step of performing serialization processing on the mesh data, generating a three-dimensional mesh file and storing the file in S104 further includes:

[0069] According to the grid level of the three-dimensional grid, the display data and display threshold corresponding to the three-dimensional grid of each grid level stored in the empty element are serialized and converted to generate a corresponding binary file;

[0070] According to the grid level of the three-dimensional grid, binary files corresponding to the three-dimensional grids of each grid level are stored respectively.

[0071] In order to facilitate those skilled in the art to better understand the method for making and generating a multi-level three-dimensional grid file provided by the present invention, the method is further supplemented by an example. Figure 2 shown.

[0072] a. Before generating empty elements corresponding to the number of grid levels and the empty element data structure of the three-dimensional grid, the number of grid levels is first set. After the setting is completed, the corresponding number of empty elements will be displayed. Each empty element data structure contains source data, display data, face reduction ratio, display threshold, material parameters, and three-dimensional grid and grid level.

[0073] Display data = source data × reduction ratio × 100%.

[0074] b. Set the source data of each level corresponding to the 3D grids of different grid levels, and set the grid data according to the things the user wants to represent. You can import external files and reference grid data of other levels. The externally imported 3D grid data will be saved in the memory as the source data of this level. Reference to other levels will copy the display data of the referenced level to this level as the source data of this level.

[0075] c. Set the face reduction ratio for each level corresponding to the 3D grids of different grid levels. After the face reduction is successful, you can view the model face reduction effect from the rendering window. Adjust a suitable value according to the rendering window effect. After the face reduction is completed, the 3D model data will be saved in the memory as the display data of this level.

[0076] d. Set the display threshold of each level of grid. When rendering, the ratio of the bounding box of the 3D grid to the rendered image will be calculated according to the camera's view matrix and projection matrix. When the ratio reaches this threshold, the rendering window will display the display data of the 3D grid at this grid level.

[0077]

[0078] e. Set the mesh material for each level. Different levels can use different PBR materials. The level displayed when it is far away from the camera can use maps with fewer pixels to save resources. After modifying the material parameters of the referenced level, the synchronization function can be used to make the meshes that reference this level apply the material of this level to reduce the setting steps and improve production efficiency.

[0079] f. After adjusting all parameters, you can view the current grid display effect by adjusting the camera position in the rendering window. The rendering window will calculate the proportion of the grid bounding box to the output screen based on the camera's view matrix and projection matrix, and select the grid whose grid display threshold is closest to this proportion value for display.

[0080]

[0081] g. Save the grid data, and save the display data and display threshold of each level (ie, each grid level) into a file in binary serialization.

[0082] h. Load the saved file and display the data of all levels (i.e. each grid level) saved in the file. The display data and threshold of each level are obtained from the file. The source data of each level is exactly the same as the display data of this level, and the face reduction ratio is 100%.

[0083] By applying the above technical solution, according to the number of grid levels of the three-dimensional grid and the empty element data structure, empty elements corresponding to the number of grid levels are generated; a user's three-dimensional grid file creation request is received and parsed, and according to the parsing result and the grid level of the three-dimensional grid, source data, face reduction ratio, display threshold and material parameters corresponding to the three-dimensional grid file creation request are respectively obtained; based on the source data and the empty elements, according to the display effect of the three-dimensional grid, the optimal face reduction ratio, display threshold and material parameters corresponding to the grids of each grid level in the three-dimensional grid are determined, and grid data is generated; the grid data is serialized, and a three-dimensional grid file is generated and stored. The invention realizes the use of 3D mesh files with arbitrary names, and dynamically debugs and serializes the surface reduction ratios corresponding to meshes of various mesh levels in the 3D mesh, and generates and stores 3D mesh files with complex requirements according to the processing and debugging results, thereby solving the technical problems of cumbersome 3D mesh production and generation, poor flexibility and difficulty in debugging in the prior art, so that the production of 3D mesh files is no longer restricted by the name specifications of 3D mesh files, and the mesh data to be displayed at any level in the 3D mesh can be determined by using an existing 3D model file with arbitrary name in a surface reduction manner, and mesh data and material data can be referenced to each other between different levels, and the rendering window can be set to display only a certain level of model or all models, thereby simplifying the process, improving flexibility and convenience of debugging for the production and generation of multi-level 3D mesh files.

[0084] In addition, by setting the reference relationship between the three-dimensional grids of different levels, the parameter setting steps are reduced and the production efficiency is improved. Each level of data is separated, and different levels are reduced based on the source data of the current level. Different levels can set material parameters separately, achieving the effect of flexible configuration. At the same time, with the three-dimensional rendering engine, the single-level and all-level mixed display effects can be viewed in real time, which is convenient for debugging and reduces rework steps. After saving the three-dimensional grid file, it can be opened and edited again, which enhances reusability.

[0085] Corresponding to the method for making and generating a multi-level three-dimensional mesh file in one embodiment of the present invention, the present invention also discloses a system for making and generating a multi-level three-dimensional mesh file, such as Figure 3 As shown, the system includes a three-dimensional grid initialization module, a grid data processing module, a three-dimensional grid generation module and a grid file storage module;

[0086] in,

[0087] The three-dimensional grid initialization module is used to generate empty elements corresponding to the number of grid levels according to the number of grid levels of the three-dimensional grid and the empty element data structure;

[0088] The mesh data processing module is used to receive and analyze the user's three-dimensional mesh file creation request, and obtain source data, face reduction ratio, display threshold and material parameters corresponding to the three-dimensional mesh file creation request according to the analysis result and the mesh level of the three-dimensional mesh;

[0089] The three-dimensional mesh generation module is used to determine the optimal face reduction ratio, display threshold and material parameters corresponding to meshes of each mesh level in the three-dimensional mesh based on the source data and the empty element and according to the display effect of the three-dimensional mesh, and generate mesh data;

[0090] The grid file storage module is used to serialize the grid data, generate a three-dimensional grid file and store it.

[0091] Each embodiment in this specification is described in a related manner, and the same or similar parts between the embodiments can be referenced to each other, and each embodiment focuses on the differences from other embodiments.

[0092] The above description is only a preferred embodiment of the present invention and is not intended to limit the protection scope of the present invention. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention are included in the protection scope of the present invention.

Claims

1. A method for making and generating a multi-level three-dimensional grid file, characterized in that: The method comprises: S101, generating empty elements corresponding to the number of grid levels of the three-dimensional grid and the empty element data structure; S102, receiving and parsing a user's request for making a three-dimensional mesh file, and acquiring source data, a face reduction ratio, a display threshold, and material parameters corresponding to the request for making a three-dimensional mesh file according to the parsing result and the mesh level of the three-dimensional mesh; S103, based on the source data and the empty element, and according to the display effect of the three-dimensional grid, determining the optimal face reduction ratio, display threshold and material parameters corresponding to grids of each grid level in the three-dimensional grid, and generating grid data; S104, serializing the mesh data to generate and store a three-dimensional mesh file; in, In step S101, the step of generating empty elements corresponding to the number of grid levels of the three-dimensional grid and the empty element data structure further includes: According to the empty element data structure, define and construct the structure of each of the empty elements, and determine the relationship between display data, source data and face reduction ratio; Acquire the number of grid levels of the three-dimensional grid set by the user, and generate the empty elements equal to the number of grid levels of the three-dimensional grid according to the number of grid levels of the three-dimensional grid; The empty element data structure includes: a three-dimensional grid, a grid level, source data, display data, a face reduction ratio, a display threshold, and material parameters; The relationship among the display data, source data and face reduction ratio is: Display data = source data × reduction ratio × 100%; In step S102, the step of respectively acquiring source data, face reduction ratio, display threshold and material parameters corresponding to the three-dimensional mesh file creation request according to the analysis result and the mesh level of the three-dimensional mesh comprises: S3-1, monitoring a 3D mesh file creation event in real time, and according to a trigger result of the 3D mesh file creation event, obtaining and parsing the 3D mesh file creation request, and determining a current 3D mesh and a mesh level in the 3D mesh corresponding to the 3D mesh file creation request; S3-2, according to the analysis result, obtaining the source data, face reduction ratio, display threshold and material parameters of the current three-dimensional mesh, storing the source data in a memory and generating a corresponding storage path; S3-3, determining display data of the current three-dimensional grid based on the source data and the face reduction ratio, and a relationship among the display data, the source data, and the face reduction ratio; S3-4, calculating and obtaining a ratio value of the enclosing frame of the current three-dimensional grid to the entire rendering screen of the three-dimensional grid according to the display threshold, and rendering and displaying the display data of the current three-dimensional grid according to the ratio value; S3-5, determining the mesh material of the current three-dimensional mesh according to the mesh level of the current three-dimensional mesh and the material parameters; S3-6, repeating steps S3-2, S3-3, S3-4 and S3-5 until the source data, face reduction ratio, display threshold and material parameters, as well as display data and mesh material of all the three-dimensional meshes are acquired and determined.

2. The method according to claim 1, characterized in that In step S3-2, the source data of the current three-dimensional grid is determined according to the type of the three-dimensional object displayed by the user, and there are two ways to obtain the source data of the current three-dimensional grid, namely external import and other level grid acquisition; When the acquisition method is external import, an external source data file is imported through a storage path corresponding to the three-dimensional mesh file production request, and source data of the current three-dimensional mesh is extracted according to the external source data file and stored in a memory; When the acquisition path is other level grid acquisition, the corresponding source data is read from the memory according to the grid level of the other level grid, and the read source data is stored in the memory using the storage path of the current three-dimensional grid.

3. The method according to claim 1, characterized in that In step S3-3, the face reduction ratio is determined according to the model face reduction effect displayed in the rendering window after the three-dimensional mesh is rendered, and three-dimensional meshes of different mesh levels correspond to different face reduction ratios; The display data of the current three-dimensional grid=the source data×the face reduction ratio×100%.

4. The method according to claim 1, characterized in that In step S3-4, the step of calculating and obtaining the ratio of the bounding box of the current three-dimensional grid to the entire rendering screen of the three-dimensional grid according to the display threshold further includes: Obtain the view matrix ViewM and projection matrix PJM of the camera corresponding to the three-dimensional grid, as well as the bounding box C3DM of the current three-dimensional grid; Calculate a ratio KM of the bounding box of the current three-dimensional grid to the entire rendering image of the three-dimensional grid according to the view matrix and the projection matrix and the bounding box of the current three-dimensional grid; Displaying the display data of the current three-dimensional grid according to the ratio value KM and the display threshold, and displaying the display data of the current three-dimensional grid when the ratio value KM is equal to or greater than the display threshold; in, The ratio value 5. The method according to claim 1, characterized in that In step S3-5, the step of determining the mesh material of the current three-dimensional mesh according to the mesh level of the current three-dimensional mesh and the material parameters further includes: Determining the distance of the current three-dimensional grid from the camera and the display level of the current three-dimensional grid according to the grid level of the current three-dimensional grid; Determining pixels and mesh materials of a texture used for rendering the current three-dimensional mesh according to the display level and the material parameters; in, The display level is inversely proportional to the distance of the current three-dimensional grid from the camera, and is directly proportional to the pixels of the texture rendered by the current three-dimensional grid and the grid material.

6. The method according to claim 1, characterized in that The step of determining the optimal face reduction ratio, display threshold and material parameters corresponding to each mesh level in the three-dimensional mesh based on the source data and the empty element according to the display effect of the three-dimensional mesh, and generating mesh data in S103 further includes: S8-1, rendering the three-dimensional mesh of each mesh level respectively based on the source data, the face reduction ratio, the display threshold and the material parameter of the three-dimensional mesh, as well as the display data and the mesh material; S8-2, adjusting the distance between the current three-dimensional grid and the camera, and calculating the ratio KM of the bounding box of the current three-dimensional grid to the entire rendering image of the three-dimensional grid according to the view matrix and the projection matrix and the bounding box of the current three-dimensional grid; S8-3, recording the face reduction ratio, material parameters, display data and mesh parameters when the ratio value KM is close to the display threshold as the optimal face reduction ratio, display threshold and material parameters, generating mesh data corresponding to the current three-dimensional mesh, and displaying the current three-dimensional mesh; S8-4, repeat steps S8-2 and S8-3 until the optimal face reduction ratio, display threshold and material parameters, as well as mesh data of all three-dimensional meshes are determined, and all mesh data are mapped to the corresponding empty elements according to the mesh levels of the three-dimensional meshes.

7. The method according to claim 1, characterized in that The step of performing serialization processing on the mesh data to generate and store a three-dimensional mesh file in S104 further includes: According to the grid level of the three-dimensional grid, the display data and display threshold corresponding to the three-dimensional grid of each grid level stored in the empty element are serialized and converted to generate a corresponding binary file; According to the grid level of the three-dimensional grid, binary files corresponding to the three-dimensional grids of each grid level are stored respectively.

8. A system for implementing the method for making and generating a multi-level three-dimensional grid file according to claim 1, characterized in that: The system includes a three-dimensional grid initialization module, a grid data processing module, a three-dimensional grid generation module and a grid file storage module; in, The three-dimensional grid initialization module is used to generate empty elements corresponding to the number of grid levels according to the number of grid levels of the three-dimensional grid and the empty element data structure; The mesh data processing module is used to receive and analyze the user's three-dimensional mesh file creation request, and obtain source data, face reduction ratio, display threshold and material parameters corresponding to the three-dimensional mesh file creation request according to the analysis result and the mesh level of the three-dimensional mesh; The three-dimensional mesh generation module is used to determine the optimal face reduction ratio, display threshold and material parameters corresponding to meshes of each mesh level in the three-dimensional mesh based on the source data and the empty element and according to the display effect of the three-dimensional mesh, and generate mesh data; The grid file storage module is used to serialize the grid data, generate a three-dimensional grid file and store it; in, The step of generating empty elements corresponding to the number of grid levels of the three-dimensional grid and the empty element data structure further comprises: According to the empty element data structure, define and construct the structure of each of the empty elements, and determine the relationship between display data, source data and face reduction ratio; Acquire the number of grid levels of the three-dimensional grid set by the user, and generate the empty elements equal to the number of grid levels of the three-dimensional grid according to the number of grid levels of the three-dimensional grid; The empty element data structure includes: a three-dimensional grid, a grid level, source data, display data, a face reduction ratio, a display threshold, and material parameters; The relationship among the display data, source data and face reduction ratio is: Display data = source data × reduction ratio × 100%; The step of respectively acquiring source data, face reduction ratio, display threshold and material parameters corresponding to the three-dimensional mesh file production request according to the analysis result and the mesh level of the three-dimensional mesh comprises: S3-1, monitoring a 3D mesh file creation event in real time, and according to a trigger result of the 3D mesh file creation event, obtaining and parsing the 3D mesh file creation request, and determining a current 3D mesh and a mesh level in the 3D mesh corresponding to the 3D mesh file creation request; S3-2, according to the analysis result, obtaining the source data, face reduction ratio, display threshold and material parameters of the current three-dimensional mesh, storing the source data in a memory and generating a corresponding storage path; S3-3, determining display data of the current three-dimensional grid based on the source data and the face reduction ratio, and a relationship among the display data, the source data, and the face reduction ratio; S3-4, calculating and obtaining a ratio value of the enclosing frame of the current three-dimensional grid to the entire rendering screen of the three-dimensional grid according to the display threshold, and rendering and displaying the display data of the current three-dimensional grid according to the ratio value; S3-5, determining the mesh material of the current three-dimensional mesh according to the mesh level of the current three-dimensional mesh and the material parameters; S3-6, repeating steps S3-2, S3-3, S3-4 and S3-5 until the source data, face reduction ratio, display threshold and material parameters, as well as display data and mesh material of all the three-dimensional meshes are acquired and determined.

Citation Information

Patent Citations

  • Self-adaption LOD model establishing method based on face clustering

    CN103886635A

  • Scene rendering method and device, computer readable storage medium and computer equipment

    CN111105491A