Model data processing method and device, electronic equipment and storage medium
By setting grid attributes and projection matrix settings for each group of files after classification, and converting formats based on the projection matrix, the problem of low efficiency in converting CSV files to FBX files in the prior art is solved, automation and batch processing are realized, and conversion efficiency is improved.
Patent Information
- Application Number
- CN202411430018.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-14
- Publication Date
- 2025-03-21
- Estimated Expiration
- 2044-10-14
AI Technical Summary
The existing method of converting CSV files to FBX files requires multiple manual operations, resulting in low conversion efficiency, especially the conversion of large batches of data is longer.
By setting grid attributes and projection matrix settings for each group of files after classification, and converting formats based on the projection matrix, automated and batch processing methods are realized to avoid manual operations.
Improve the conversion efficiency of CSV files to FBX files, realize automation and batch processing, and reduce the time and cost of human operations.
Smart Images

Figure CN119669148A_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of computer technology, and in particular to a method, device, electronic device and storage medium for processing model data. Background Art
[0002] In some scenarios, such as 3D graphics processing or game development, it is often necessary to export relevant data in CSV format to capture and analyze rendering data, thereby optimizing performance and solving visual problems. However, the point data in the CSV file alone cannot be directly placed in the 3D modeling software or engine for intuitive visualization and editing, so the CSV file needs to be converted to FBX format. Currently, the original data in the CSV file is gradually converted into geometric information by creating and linking various nodes, and exported as an FBX file.
[0003] However, the existing method of converting CSV files to FBX files requires multiple manual operations, which is too time-consuming for large-scale data conversion, resulting in low conversion efficiency of CSV files to FBX files. Summary of the invention
[0004] In view of this, the purpose of the present disclosure is to provide a method, device, electronic device and storage medium for processing model data. By setting the grid properties and projection matrix of each group of classified files and performing format conversion based on the projection matrix, multiple manual operations are not required, thereby realizing automated and batch processing and improving the conversion efficiency of CSV files to FBX files.
[0005] In a first aspect, an embodiment of the present disclosure provides a method for processing model data, the method for processing model data comprising:
[0006] Classifying the target file set to obtain classified groups of files, wherein each file in the target file set is used to store point data of the three-dimensional model;
[0007] Setting the mesh attributes of each group of files, wherein the mesh attributes are data sets constituting the mesh of the three-dimensional model;
[0008] generating a projection matrix based on the mesh attributes of each group of files;
[0009] Based on the projection matrix, the formats of the groups of files are converted to obtain model data in a target format corresponding to each file.
[0010] In a second aspect, an embodiment of the present disclosure provides a model data processing device, the model data processing device comprising:
[0011] A classification module, used for classifying the target file set to obtain each group of classified files, wherein each file in the target file set is used to store point data of the three-dimensional model;
[0012] Setting module, used for extracting module, used for extracting attributes of data in the classified file to obtain extracted data attributes;
[0013] A generation module, used for generating a projection matrix based on the grid attributes of each group of files;
[0014] The conversion module is used to perform format conversion on each group of files based on the projection matrix to obtain model data in a target format corresponding to each file.
[0015] In a third aspect, an embodiment of the present disclosure provides an electronic device, including a processor and a memory, wherein the memory stores machine executable instructions that can be executed by the processor, and the processor executes the machine executable instructions to implement the above-mentioned model data processing method.
[0016] In a fourth aspect, an embodiment of the present disclosure provides a computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the above-mentioned model data processing method.
[0017] The embodiments of the present disclosure bring the following beneficial effects:
[0018] The above-mentioned model data processing method, device, electronic device and storage medium classify the target file set to obtain each group of files after classification, wherein each file in the target file set is used to store the point data of the three-dimensional model; set the grid attributes of each group of files, wherein the grid attributes are the data sets that constitute the grid of the three-dimensional model; generate a projection matrix based on the grid attributes of each group of files; based on the projection matrix, perform format conversion on each group of files to obtain the model data of the target format corresponding to each file. In this method, by setting the grid attributes and projection matrix of each group of files after classification, and performing format conversion based on the projection matrix, multiple manual operations are not required, and an automated and batch processing method is realized, which improves the conversion efficiency of CSV files to FBX files.
[0019] Other features and advantages of the present disclosure will be described in the following description, and partly become apparent from the description, or understood by practicing the present disclosure. The purpose and other advantages of the present disclosure are realized and obtained by the structures particularly pointed out in the description, claims and drawings.
[0020] In order to make the above-mentioned objectives, features and advantages of the present disclosure more obvious and easy to understand, preferred embodiments are specifically cited below and described in detail with reference to the attached drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0021] In order to more clearly illustrate the specific embodiments of the present disclosure or the technical solutions in the prior art, the drawings required for use in the specific embodiments or the description of the prior art will be briefly introduced below. Obviously, the drawings described below are some embodiments of the present disclosure. For those skilled in the art, other drawings can be obtained based on these drawings without paying any creative work.
[0022] Figure 1 A schematic diagram of an embodiment of a method for processing model data provided by an embodiment of the present disclosure;
[0023] Figure 2 A schematic diagram of an embodiment of the layout of each group of components in a graphical user interface provided by an embodiment of the present disclosure;
[0024] Figure 3 A schematic diagram of a model data processing device provided in an embodiment of the present disclosure;
[0025] Figure 4 A schematic diagram of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0026] In order to make the purpose, technical solution and advantages of this embodiment clearer, the technical solution of this disclosure will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the described embodiments are part of the embodiments of this disclosure, rather than all the embodiments. Based on the embodiments in this disclosure, all other embodiments obtained by those skilled in the art without creative work are within the scope of protection of this disclosure.
[0027] In some scenarios, such as three-dimensional (3D) graphics processing or game development scenarios, it is often necessary to export relevant data in CSV format to capture and analyze rendering data, thereby optimizing performance and solving visual problems. Among them, the open source graphics debugging tool RenderDoc can record and store the rendering instructions and point data of an application in a specific frame, and export it in CSV format, which is often used. However, the point data (e.g., vertex position, normal, texture map (UV) coordinates, etc.) in the exported CSV file cannot be directly placed in a 3D modeling software or engine for intuitive visualization and editing, which requires converting the CSV file into FBX format. At present, the raw data in the CSV file is gradually converted into geometric information by creating and linking various nodes, and exported as an FBX file. For example, a CSV file is created in the tool Houdini through a pre-written script, and the point data (e.g., vertex position, normal, UV coordinates, etc.) in the CSV file is parsed and loaded into the Houdini working environment, and then various nodes are created and linked to gradually convert these raw data into Houdini's geometric information, and finally the processed geometric information is exported as an FBX file through Houdini's export function.
[0028] However, the existing methods of converting CSV files to FBX files require high operating costs, require artists to be proficient in using Houdini, which is difficult to use, and require multiple manual operations. It is too time-consuming to convert large quantities of data, resulting in low conversion efficiency of CSV files to FBX files.
[0029] This embodiment provides a model data processing method, device, electronic device and storage medium, which can be applied to model data processing scenarios, especially game model data processing scenarios.
[0030] The method for processing model data in one embodiment of the present disclosure may be run on a terminal device or a server. The terminal device may be a local terminal device. When the method for processing model data is run on a server, the method may be implemented and executed based on a cloud interaction system, wherein the cloud interaction system includes a server and a client device.
[0031] For ease of understanding, the specific process of this embodiment is described below. Figure 1 In this embodiment, an embodiment of the method for processing model data includes the following steps:
[0032] Step 101, classifying the target file set to obtain each group of classified files, wherein each file in the target file set is used to store point data of the three-dimensional model;
[0033] The target file set includes more than one file to be processed, and each file in the target file set is a file storing point data constituting a three-dimensional model. The point data includes but is not limited to key information such as vertex data, normal data, and UV coordinates. In addition, the point data may also include vertex color and tangent information, etc., which have an important impact on the rendering effect.
[0034] Among them, each file in the target file set may be a file storing point data of each model in the same scene, or may be a file storing point data of each model in different scenes.
[0035] As an example but not limitation, based on preset classification rules, the target file set is identified and classified to obtain classified groups of files, wherein the preset classification rules are classification strategies set to avoid batch export problems caused by subsequent parameter (attribute) settings. The preset classification rules can be the number of columns of the file, the type of file content, or the sameness of file information, etc., which are not specifically limited here.
[0036] Step 102, setting the grid attributes of each group of files, wherein the grid attributes are data sets constituting the grid of the three-dimensional model;
[0037] The mesh attributes include but are not limited to vertex information, normal information, and texture mapping coordinate information.
[0038] As an example but not limitation, when setting the grid properties of each group of files, you can: obtain the attribute information in each group of files; in response to the setting instructions of the grid properties, obtain the parameter values corresponding to the grid properties of each group of files; based on the attribute information, determine whether the parameter values meet the preset conditions, where the preset conditions include but are not limited to data integrity, data format, data range and data consistency; if so, the setting is completed, and the parameter values are used as the grid properties of each group of files after setting; if not, the results are fed back, and the parameter values corresponding to the grid properties of each group of files are re-obtained.
[0039] Step 103, generating a projection matrix based on the grid attributes of each group of files;
[0040] Among them, as an example but not limitation, when generating a projection matrix based on the grid properties of each group of files, it is possible to: integrate the grid properties of each group of files to obtain target properties; determine the projection type and visual parameters, wherein the projection type may be an orthogonal projection or a perspective projection, and the visual parameters include but are not limited to viewing angle parameters, field of view parameters, near clipping plane parameters, and far clipping plane parameters; generate a projection matrix based on the target properties, projection type, and visual parameters.
[0041] As an example but not limitation, when generating a projection matrix based on the grid properties of each group of files, it is also possible to: obtain parameter values, where the parameter values may be numerical values of visual parameters or other numerical values for generating the projection matrix; perform a rationality test on the parameter values based on the grid properties of each group of files to obtain tested parameter values, where the tested parameter values are used to indicate that the parameter value rationality test has passed; and generate a projection matrix based on the parameter values.
[0042] The target file set shares a projection matrix, that is, the projection matrices corresponding to all files in the target file set are the same projection matrix.
[0043] Step 104 , based on the projection matrix, format conversion is performed on each group of files to obtain model data in a target format corresponding to each file.
[0044] Among them, as an example but not limitation, an inverse matrix transformation operation is performed based on the projection matrix to obtain transformed point data (for example, transformed vertex positions); based on the transformed point data, a mesh is constructed and mesh information is filled to obtain model data in a target format corresponding to each file, wherein the mesh information for mesh information filling includes but is not limited to normal information and texture map coordinate information.
[0045] Here, batch processing is performed on each group of files, that is, the files in the same group are processed in parallel to perform the processing flow of format conversion, so as to obtain model data in the target format corresponding to each file in the same group.
[0046] The above-mentioned method for processing model data realizes automated and batch processing by setting mesh properties and projection matrices for each group of classified files and performing format conversion based on the projection matrix. This method does not require multiple manual operations and improves the conversion efficiency of CSV files to FBX files.
[0047] In one implementation, when format conversion is performed on each group of files based on the projection matrix to obtain model data in a target format corresponding to each file, the following can be done: construct an initial mesh body of each file based on the vertex positions and projection matrices in each file in each group of files; obtain vertex index data, normal information, and texture mapping coordinates in each file in each group of files; write the normal information in each file into the initial mesh body of each file according to the vertex index data in each file to obtain a mesh body to be processed for each file; write the texture mapping coordinates in each file into the mesh body to be processed for each file according to the vertex index data in each file to obtain model data in the target format corresponding to each file.
[0048] Based on the vertex positions and projection matrices in each file in each group of files, operations are performed to obtain the vertex positions for constructing the initial mesh of each file, and the vertex positions are filled into the pre-created empty mesh, and polygons are created to construct the initial mesh of each file. According to the vertex index data in each file, the normal information and texture map (UV) coordinates in each file are written into the initial mesh of each file to improve the initial mesh of each file and obtain the model data of the target format corresponding to each file.
[0049] Among them, based on the projection matrix, the execution process of format conversion for each group of files is executed in parallel, that is, the model data of the target format corresponding to all files in the target file set are obtained at the same time.
[0050] By constructing the initial mesh based on vertex positions and projection matrices, and writing the normal information and texture map coordinates in each file into the initial mesh according to the vertex index data in each file, batch files can be processed uniformly and automatically, avoiding problems such as parameter adjustment errors and missing configurations, and improving the efficiency and accuracy of the conversion.
[0051] In one implementation, when constructing the initial mesh body of each file based on the vertex positions and projection matrix in each file in each group of files, you can: create an empty mesh; map the vertex positions in each file in each group of files to a two-dimensional screen through the projection matrix to obtain the mapped vertex positions; perform an inverse matrix transformation of the projection matrix on the mapped vertex positions to obtain the transformed vertex positions; set the transformed vertex positions to the corresponding vertices in the empty mesh to obtain the mesh after the vertex information is constructed; construct polygons based on the vertices in each file, and add the constructed polygons to the mesh after the vertex information is constructed to obtain the initial mesh body of each file.
[0052] As an example but not limitation, when mapping the vertex positions in each file in each group of files to a two-dimensional screen through a projection matrix to obtain the mapped vertex positions, it is possible to: create a first vector through a preset calculation function, and create a second vector based on the vertex positions in each file in each group of files, wherein the first vector is a 4-dimensional vector of all zeros (a zero vector of length 4), and the second vector is a one-dimensional array of length 4; use the first vector as the initial value of the result vector, calculate the product of each element in the projection matrix and the corresponding element in the second vector (i.e., perform a nested loop on the projection matrix, and multiply the current row traversed in the projection matrix by the corresponding element of the second vector), obtain the operation result, and accumulate the operation result to the corresponding position of the first vector to obtain the mapped vertex position.
[0053] As an example but not limitation, when performing an inverse matrix transformation of the projection matrix on the mapped vertex positions to obtain the transformed vertex positions, it is possible to: calculate the inverse matrix of the projection matrix through a preset first setting function, wherein the first setting function is used to set the vertex positions of the mesh; traverse the mapped vertex positions of each row except the first row, and based on the inverse matrix, perform an inverse matrix transformation of the projection matrix on the vertex positions of each row to obtain the transformed vertex positions.
[0054] Among them, the projection matrix must be transformed to ensure that the position of the mesh in the world space (the position in the model data of the converted target format) is consistent with the position stored in the target file.
[0055] As an example but not limitation, when constructing polygons based on the vertices in each file and adding the constructed polygons to the mesh after the vertex information is constructed to obtain the initial mesh body of each file, you can: use a preset second setting function, where the second setting function is used to set the polygons of the mesh; traverse every three rows in each file, construct a polygon based on the vertices of every three traversed rows, and add the constructed polygons to the mesh after the vertex information is constructed to obtain the initial mesh body of each file.
[0056] By calculating the product of the projection matrix and the vector, and setting the vertex positions and polygons of the mesh, it helps to uniformly process batch files, improves the accuracy of texture mapping, reduces the amount of calculation, improves processing efficiency, and helps to improve the quality and availability of the model data (FBX file) in the target format corresponding to each file after conversion.
[0057] In one implementation, when the normal information in each file is written into the initial mesh body of each file according to the vertex index data in each file to obtain the mesh body to be processed of each file, it is possible to: create a normal layer of the initial mesh body of each file, and set the mode of the normal layer to obtain the first mesh body of each file; obtain the static array of the normal layer in the first mesh body and the number of elements in each file; adjust the size of the static array based on the number of elements to obtain the adjusted static array; write the normal information of each file into the corresponding vertices in the first mesh body of each file according to the vertex index data of each file, and add the normal information of each file to the corresponding position in the adjusted static array to obtain the mesh body to be processed of each file.
[0058] As an example but not limitation, when creating a normal layer for the initial mesh of each file and setting the mode of the normal layer to obtain the first mesh of each file, you can: create a new normal layer corresponding to the initial mesh of each file, and remove the first normal element from the initial mesh; set the first mapping mode and the first reference mode of the normal layer, wherein the first mapping mode is used to indicate that each control point has a corresponding normal, for example, eByControlPoint, and the first reference mode is used to indicate that the normal data is directly stored in an array, for example, eDirect.
[0059] Wherein, as an example but not limitation, the static array may also be a direct array, for example, normal_array. The number of elements in each file may be understood as the length of the table in the file. After obtaining the static array of the normal layer in the first mesh and the number of elements in each file, the number of elements is stored in a specific variable (for example, count), and the size of the static array is adjusted to the size of the specific variable.
[0060] The vertex index data in each file includes vertex index data (ID_idx) of each row (except the first row), and the normal information in each file includes normal information of each row (except the first row).
[0061] By creating a normal layer for the initial mesh and setting the mode, and adding the normal information of each file to the corresponding positions in the static array that is resized based on the number of elements and the corresponding vertices in the mesh, the authenticity and accuracy of the mesh are improved, resource usage is reduced, dynamic adjustment is facilitated, and processing flexibility and a wide range of application scenarios are enhanced.
[0062] In one implementation, when writing the texture mapping coordinates in each file into the mesh to be processed in each file according to the vertex index data in each file to obtain the model data in the target format corresponding to each file, it is possible to: create a texture coordinate layer for the mesh to be processed in each file, and set the mode of the texture coordinate layer to obtain the second mesh in each file; obtain the static array and index array of the normal layer in the second mesh, and the number of elements in each file; adjust the sizes of the static array and the index array based on the number of elements to obtain the adjusted static array and the adjusted index array; write the texture mapping coordinates of each file into the corresponding position in the adjusted static array, and add the vertex index data of each file to the corresponding position in the adjusted index array to obtain the model data in the target format corresponding to each file.
[0063] As an example but not limitation, a texture coordinate layer of the mesh to be processed in each file is created, and a target name corresponding to the texture coordinate layer is set, wherein the target name is the name of the texture coordinate layer plus the index name; a second mapping mode and a second reference mode of the texture coordinate layer are set, wherein the second mapping mode is used to indicate that each polygon vertex has a corresponding texture coordinate, for example, eByPolygonVertex, and the second reference mode is used to indicate that the texture coordinate data is referenced by an index array, for example, uv_index_array. After obtaining the static array and index array of the normal layer in the second mesh, as well as the number of elements in each file, the number of elements is stored in a specific variable (for example, count), the size of the static array is adjusted to the size of the specific variable minus 1 (i.e., count-1), and the size of the index array is adjusted to the size of the specific variable minus 1 (i.e., count-1).
[0064] The vertex index data in each file includes vertex index data (ID_idx) of each row (except the first row), and the texture mapping coordinates in each file include texture mapping coordinates of each row (except the first row).
[0065] By creating a texture coordinate layer for the initial mesh and setting the mode, adding the texture mapping coordinates of each file to the corresponding position in the static array after resizing based on the number of elements, and adding the vertex index data of each file to the corresponding position in the adjusted index array, it has a certain dynamic adjustment capability and can adapt to textures and vertex data of different scales, thereby achieving accurate texture mapping, efficient use of resources, and centralized management and updating of data.
[0066] In one implementation, when classifying a target file set to obtain each group of classified files, the following steps may be performed: parsing each file in the target file set to obtain parsed file data; and classifying each file in the target file set based on the type of the parsed file data to obtain each group of classified files, wherein each file in each group of files has the same number of columns.
[0067] As an example but not a limitation, before parsing each file in the target file set, the file path of the target file set is obtained, and the target file set is imported based on the file path. After the target file set is imported based on the file path, each file in the target file set is parsed to obtain parsed file data, wherein the parsed file data may be drawing data of a virtual model; and files corresponding to the same data type and / or having the same information in the parsed file data are classified into the same group of files, thereby obtaining each group of classified files.
[0068] Among them, as an example but not a limitation, due to different models, each file has a different number of columns, and each column in each file represents a specific attribute or dimension, such as vertex data, normal data, UV coordinates, color data and other related attributes. The data items in each column (i.e., the values in the row) correspond to the specific values of the attribute for all elements or entities in the three-dimensional model, and each column provides a specific perspective or dimension of the model data; each file includes drawing data of the three-dimensional model.
[0069] By classifying the files in the target file set, batch export problems during parameter adjustment can be avoided, as well as model data errors and data mismatches after format conversion of each group of files due to inconsistent data information. This improves the quality of the model data in the target format and ensures the efficiency and accuracy of batch format conversion of each group of files.
[0070] In one implementation, a graphical user interface is provided through a terminal device, and the graphical user interface includes: a first group of components, used to trigger classification instructions to classify a target file set; a second group of components, used to trigger grid attribute setting instructions to set grid attributes; a third group of components, used to trigger matrix generation instructions to generate a projection matrix based on the grid attributes of each group of files; a fourth group of components, used to trigger format conversion instructions to convert the format of each group of files.
[0071] Each component is arranged and displayed in the graphical user interface in a preset order, wherein the preset order corresponds to the order of the processing flow of the model data, for example, the order from top to bottom. Each component in the graphical user interface may be shown in the figure.
[0072] In addition, as an example but not a limitation, the graphical user interface also includes: a sixth group of components, which is used to set the file path of the target file set and import the target file set based on the file path. Among them, each group of components in the graphical user interface may include at least one component, and each component in the graphical user interface may be an interactive control. The touch operation of each component may be a preset operation such as clicking, editing input, sliding, etc., which is not specifically limited here and can be set according to actual needs. For example, the sixth group of components, the second group of components and the fourth group of components can all perform text input operations, and the first group of components and the third group of components can all perform operations such as clicking.
[0073] By laying out multiple groups of components through a graphical user interface, a more user-friendly UI interface is provided, which is easy to operate and helps to reduce parameter adjustments to solve problems such as parameter adjustment errors and missing parameters that lead to incorrect fbx model data, thereby improving operational efficiency and helping to improve the conversion efficiency and accuracy of CSV files to FBX files.
[0074] In one implementation, Figure 2 As shown, the graphical user interface also includes: a fifth group of components, which is used to trigger the attribute acquisition instruction to obtain the data attributes in each group of files after classification. When setting the grid attributes of each group of files, it is possible to: extract the data attributes in each group of files after classification through the fifth group of components, and display the extracted data attributes; obtain the grid attributes to be edited of each group of files in response to the trigger operation on the second group of components; and display the grid attributes to be edited through the second group of components.
[0075] As an example but not limitation, the extracted data attributes are displayed at the positions corresponding to each preset item in the graphical user interface through the fifth group of components; after obtaining the grid attributes to be edited of each group of files, it is verified whether the grid attributes to be edited comply with preset rules, wherein the preset rules are used to indicate data integrity, data format standardization, reasonable data range, data consistency and feasibility; if so, the grid attributes to be edited are displayed through the second group of components; if not, the verification results are fed back through the graphical user interface, and in response to the re-triggering operation of the second group of components, the grid attributes to be edited of each group of files are re-obtained.
[0076] The fifth group of components is used to display the extracted data attributes, and the second group of components is used to display the grid attributes to be edited. There is no need to manually open each file one by one, which makes it easy for users to read the target file set and judge and confirm related data based on the file content, thereby improving the parameter adjustment efficiency when converting CSV files to FBX files, thereby improving the conversion efficiency of CSV files to FBX files.
[0077] Corresponding to the above method embodiment, see Figure 3 A schematic diagram of a model data processing device shown, the device comprising:
[0078] A classification module 301 is used to classify the target file set to obtain each group of classified files, wherein each file in the target file set is used to store point data of the three-dimensional model;
[0079] Setting module 302, used for extracting module, used for extracting attributes of data in classified files, and obtaining extracted data attributes;
[0080] A generation module 303, used to generate a projection matrix based on the grid attributes of each group of files;
[0081] The conversion module 304 is used to perform format conversion on each group of files based on the projection matrix to obtain model data in a target format corresponding to each file.
[0082] The above-mentioned model data processing device realizes automated and batch processing by setting grid properties and projection matrices for each group of classified files and converting the formats based on the projection matrix, without the need for multiple manual operations, thereby improving the conversion efficiency of CSV files to FBX files.
[0083] Optionally, the conversion module 304 may also be used to:
[0084] Build the initial mesh of each file based on the vertex positions and projection matrices in each file in each group of files;
[0085] Get the vertex index data, normal information and texture map coordinates in each file in each group of files;
[0086] According to the vertex index data in each file, the normal information in each file is written into the initial mesh of each file to obtain the mesh to be processed of each file;
[0087] According to the vertex index data in each file, the texture map coordinates in each file are written into the to-be-processed mesh body of each file, and the model data in the target format corresponding to each file is obtained.
[0088] Optionally, the conversion module 304 may also be used to:
[0089] Create an empty grid;
[0090] Mapping the vertex positions in each file in each group of files to a two-dimensional screen through a projection matrix to obtain the mapped vertex positions;
[0091] Performing an inverse matrix transformation of the projection matrix on the mapped vertex positions to obtain the transformed vertex positions;
[0092] The transformed vertex positions are set to the corresponding vertices in the empty mesh to obtain the mesh after the vertex information is constructed;
[0093] Polygons are constructed based on the vertices in each file, and the constructed polygons are added to the mesh after the vertex information is constructed to obtain the initial mesh body of each file.
[0094] Optionally, the conversion module 304 may also be used to:
[0095] Create a normal layer of the initial mesh of each file and set the mode of the normal layer to obtain the first mesh of each file;
[0096] Get the static array of the normal layer in the first mesh and the number of elements in each file;
[0097] Adjust the size of the static array based on the number of elements to obtain an adjusted static array;
[0098] The normal information of each file is written into the corresponding vertex in the first mesh of each file according to the vertex index data of each file, and the normal information of each file is added to the corresponding position in the adjusted static array to obtain the mesh to be processed of each file.
[0099] Optionally, the conversion module 304 may also be used to:
[0100] Create a texture coordinate layer of the mesh to be processed in each file, and set the mode of the texture coordinate layer to obtain the second mesh in each file;
[0101] Get the static array and index array of the normal layer in the second mesh, as well as the number of elements in each file;
[0102] The sizes of the static array and the index array are adjusted based on the number of elements to obtain an adjusted static array and an adjusted index array;
[0103] The texture map coordinates of each file are written into the corresponding position in the adjusted static array, and the vertex index data of each file is added to the corresponding position in the adjusted index array to obtain the model data of the target format corresponding to each file.
[0104] Optionally, the classification module 301 may also be used to:
[0105] Parse each file in the target file set to obtain the parsed file data;
[0106] Based on the type of the parsed file data, each file in the target file set is classified to obtain each group of files after classification, wherein each file in each group of files has the same number of columns.
[0107] Optionally, a graphical user interface is provided through the terminal device, and the graphical user interface includes:
[0108] The first set of components is used to trigger classification instructions to classify the target file set;
[0109] The second group of components is used to trigger the grid property setting instruction to set the grid properties;
[0110] A third group of components is used to trigger a matrix generation instruction to generate a projection matrix based on the mesh attributes of each group of files;
[0111] The fourth group of components is used to trigger the format conversion instruction to perform format conversion on each group of files.
[0112] Optionally, the graphical user interface further includes: a fifth group of components, used to trigger the attribute acquisition instruction to obtain data attributes in each group of classified files;
[0113] Extracting data attributes from each group of classified files through a fifth group of components, and displaying the extracted data attributes;
[0114] In response to the triggering operation on the second group of components, obtaining the grid properties to be edited of each group of files;
[0115] The second group of components displays the mesh properties to be edited.
[0116] This embodiment also provides an electronic device, including a processor and a memory, wherein the memory stores machine executable instructions that can be executed by the processor, and the processor executes the machine executable instructions to implement the above-mentioned model data processing method. The electronic device can be a server or a terminal device.
[0117] See also Figure 4 As shown, the electronic device includes a processor 400 and a memory 401 , wherein the memory 401 stores machine executable instructions that can be executed by the processor 400 , and the processor 400 executes the machine executable instructions to implement the above-mentioned model data processing method.
[0118] Further, Figure 4 The electronic device shown further includes a bus 402 and a communication interface 403 , and the processor 400 , the communication interface 403 and the memory 401 are connected via the bus 402 .
[0119] The memory 401 may include a high-speed random access memory (RAM), and may also include a non-volatile memory, such as at least one disk storage. The communication connection between the system network element and at least one other network element is realized through at least one communication interface 403 (which may be wired or wireless), and the Internet, wide area network, local area network, metropolitan area network, etc. may be used. The bus 402 may be an ISA bus, a PCI bus, or an EISA bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc. For ease of representation, Figure 4 Only one bidirectional arrow is used in the diagram, but this does not mean that there is only one bus or only one type of bus.
[0120] The processor 400 may be an integrated circuit chip with signal processing capabilities. In the implementation process, each step of the above method can be completed by the hardware integrated logic circuit or software instructions in the processor 400. The above processor 400 can be a general-purpose processor, including a central processing unit (CPU), a network processor (NP), etc.; it can also be a digital signal processor (DSP), an application-specific integrated circuit (ASIC), a field-programmable gate array (FPGA) or other programmable logic devices, discrete gates or transistor logic devices, discrete hardware components. The methods, steps and logic block diagrams disclosed in this embodiment can be implemented or executed. The general processor can be a microprocessor or the processor can also be any conventional processor, etc. The steps of the method disclosed in conjunction with this embodiment can be directly embodied as a hardware decoding processor to execute, or a combination of hardware and software modules in the decoding processor to execute. The software module may be located in a storage medium mature in the art, such as a random access memory, a flash memory, a read-only memory, a programmable read-only memory, or an electrically erasable programmable memory, a register, etc. The storage medium is located in the memory 401, and the processor 400 reads the information in the memory 401 and completes the following steps in combination with its hardware:
[0121] Classifying the target file set to obtain classified groups of files, wherein each file in the target file set is used to store point data of the three-dimensional model;
[0122] Set the mesh properties of each group of files, where the mesh properties are data sets that constitute the mesh of the three-dimensional model;
[0123] generating a projection matrix based on the mesh properties of each set of files;
[0124] Based on the projection matrix, each group of files is converted into a format to obtain model data in a target format corresponding to each file.
[0125] By setting the mesh properties and projection matrix for each group of classified files and performing format conversion based on the projection matrix, multiple manual operations are no longer required, thus achieving automated and batch processing and improving the conversion efficiency of CSV files to FBX files.
[0126] The above step of converting the formats of each group of files based on the projection matrix to obtain the model data of the target format corresponding to each file includes:
[0127] Build the initial mesh of each file based on the vertex positions and projection matrices in each file in each group of files;
[0128] Get the vertex index data, normal information and texture map coordinates in each file in each group of files;
[0129] According to the vertex index data in each file, the normal information in each file is written into the initial mesh of each file to obtain the mesh to be processed of each file;
[0130] According to the vertex index data in each file, the texture map coordinates in each file are written into the to-be-processed mesh body of each file, and the model data in the target format corresponding to each file is obtained.
[0131] The above steps of constructing the initial mesh of each file based on the vertex positions and projection matrices in each file of each group of files include:
[0132] Create an empty grid;
[0133] Mapping the vertex positions in each file in each group of files to a two-dimensional screen through a projection matrix to obtain the mapped vertex positions;
[0134] Performing an inverse matrix transformation of the projection matrix on the mapped vertex positions to obtain the transformed vertex positions;
[0135] The transformed vertex positions are set to the corresponding vertices in the empty mesh to obtain the mesh after the vertex information is constructed;
[0136] Polygons are constructed based on the vertices in each file, and the constructed polygons are added to the mesh after the vertex information is constructed to obtain the initial mesh body of each file.
[0137] The above step of writing the normal information in each file into the initial mesh of each file according to the vertex index data in each file to obtain the mesh to be processed of each file includes:
[0138] Create a normal layer of the initial mesh of each file and set the mode of the normal layer to obtain the first mesh of each file;
[0139] Get the static array of the normal layer in the first mesh and the number of elements in each file;
[0140] Adjust the size of the static array based on the number of elements to obtain an adjusted static array;
[0141] The normal information of each file is written into the corresponding vertex in the first mesh of each file according to the vertex index data of each file, and the normal information of each file is added to the corresponding position in the adjusted static array to obtain the mesh to be processed of each file.
[0142] The above step of writing the texture map coordinates in each file into the to-be-processed mesh body of each file according to the vertex index data in each file to obtain the model data in the target format corresponding to each file includes:
[0143] Create a texture coordinate layer of the mesh to be processed in each file, and set the mode of the texture coordinate layer to obtain the second mesh in each file;
[0144] Get the static array and index array of the normal layer in the second mesh, as well as the number of elements in each file;
[0145] The sizes of the static array and the index array are adjusted based on the number of elements to obtain an adjusted static array and an adjusted index array;
[0146] The texture map coordinates of each file are written into the corresponding position in the adjusted static array, and the vertex index data of each file is added to the corresponding position in the adjusted index array to obtain the model data of the target format corresponding to each file.
[0147] The above step of classifying the target file set to obtain the classified groups of files includes:
[0148] Parse each file in the target file set to obtain the parsed file data;
[0149] Based on the type of the parsed file data, each file in the target file set is classified to obtain each group of files after classification, wherein each file in each group of files has the same number of columns.
[0150] A graphical user interface is provided through the terminal device, and the graphical user interface includes:
[0151] The first set of components is used to trigger classification instructions to classify the target file set;
[0152] The second group of components is used to trigger the grid property setting instruction to set the grid properties;
[0153] A third group of components is used to trigger a matrix generation instruction to generate a projection matrix based on the mesh attributes of each group of files;
[0154] The fourth group of components is used to trigger the format conversion instruction to perform format conversion on each group of files.
[0155] The graphical user interface further includes: a fifth group of components for triggering an attribute acquisition instruction to acquire data attributes in each group of classified files. The step of setting the grid attributes of each group of files includes:
[0156] Extracting data attributes from each group of classified files through a fifth group of components, and displaying the extracted data attributes;
[0157] In response to the triggering operation on the second group of components, obtaining the grid properties to be edited of each group of files;
[0158] The second group of components displays the mesh properties to be edited.
[0159] This embodiment further provides a computer-readable storage medium, which stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the following steps of the above-mentioned model data processing method:
[0160] Classifying the target file set to obtain classified groups of files, wherein each file in the target file set is used to store point data of the three-dimensional model;
[0161] Set the mesh properties of each group of files, where the mesh properties are data sets that constitute the mesh of the three-dimensional model;
[0162] generating a projection matrix based on the mesh properties of each set of files;
[0163] Based on the projection matrix, each group of files is converted into a format to obtain model data in a target format corresponding to each file.
[0164] By setting the mesh properties and projection matrix for each group of classified files and performing format conversion based on the projection matrix, multiple manual operations are no longer required, thus achieving automated and batch processing and improving the conversion efficiency of CSV files to FBX files.
[0165] The above step of converting the formats of each group of files based on the projection matrix to obtain the model data of the target format corresponding to each file includes:
[0166] Build the initial mesh of each file based on the vertex positions and projection matrices in each file in each group of files;
[0167] Get the vertex index data, normal information and texture map coordinates in each file in each group of files;
[0168] According to the vertex index data in each file, the normal information in each file is written into the initial mesh of each file to obtain the mesh to be processed of each file;
[0169] According to the vertex index data in each file, the texture map coordinates in each file are written into the to-be-processed mesh body of each file, and the model data in the target format corresponding to each file is obtained.
[0170] The above steps of constructing the initial mesh of each file based on the vertex positions and projection matrices in each file of each group of files include:
[0171] Create an empty grid;
[0172] Mapping the vertex positions in each file in each group of files to a two-dimensional screen through a projection matrix to obtain the mapped vertex positions;
[0173] Performing an inverse matrix transformation of the projection matrix on the mapped vertex positions to obtain the transformed vertex positions;
[0174] The transformed vertex positions are set to the corresponding vertices in the empty mesh to obtain the mesh after the vertex information is constructed;
[0175] Polygons are constructed based on the vertices in each file, and the constructed polygons are added to the mesh after the vertex information is constructed to obtain the initial mesh body of each file.
[0176] The above step of writing the normal information in each file into the initial mesh of each file according to the vertex index data in each file to obtain the mesh to be processed of each file includes:
[0177] Create a normal layer of the initial mesh of each file and set the mode of the normal layer to obtain the first mesh of each file;
[0178] Get the static array of the normal layer in the first mesh and the number of elements in each file;
[0179] Adjust the size of the static array based on the number of elements to obtain an adjusted static array;
[0180] The normal information of each file is written into the corresponding vertex in the first mesh of each file according to the vertex index data of each file, and the normal information of each file is added to the corresponding position in the adjusted static array to obtain the mesh to be processed of each file.
[0181] The above step of writing the texture map coordinates in each file into the to-be-processed mesh body of each file according to the vertex index data in each file to obtain the model data in the target format corresponding to each file includes:
[0182] Create a texture coordinate layer of the mesh to be processed in each file, and set the mode of the texture coordinate layer to obtain the second mesh in each file;
[0183] Get the static array and index array of the normal layer in the second mesh, as well as the number of elements in each file;
[0184] The sizes of the static array and the index array are adjusted based on the number of elements to obtain an adjusted static array and an adjusted index array;
[0185] The texture map coordinates of each file are written into the corresponding position in the adjusted static array, and the vertex index data of each file is added to the corresponding position in the adjusted index array to obtain the model data of the target format corresponding to each file.
[0186] The above step of classifying the target file set to obtain the classified groups of files includes:
[0187] Parse each file in the target file set to obtain the parsed file data;
[0188] Based on the type of the parsed file data, each file in the target file set is classified to obtain each group of files after classification, wherein each file in each group of files has the same number of columns.
[0189] A graphical user interface is provided through the terminal device, and the graphical user interface includes:
[0190] The first set of components is used to trigger classification instructions to classify the target file set;
[0191] The second group of components is used to trigger the grid property setting instruction to set the grid properties;
[0192] A third group of components is used to trigger a matrix generation instruction to generate a projection matrix based on the mesh attributes of each group of files;
[0193] The fourth group of components is used to trigger the format conversion instruction to perform format conversion on each group of files.
[0194] The graphical user interface further includes: a fifth group of components for triggering an attribute acquisition instruction to acquire data attributes in each group of classified files. The step of setting the grid attributes of each group of files includes:
[0195] Extracting data attributes from each group of classified files through a fifth group of components, and displaying the extracted data attributes;
[0196] In response to the triggering operation on the second group of components, obtaining the grid properties to be edited of each group of files;
[0197] The second group of components displays the mesh properties to be edited.
[0198] The computer program product of the model data processing method, device, electronic device and storage medium provided in this embodiment includes a computer-readable storage medium storing program code. The instructions included in the program code can be used to execute the methods described in the previous method embodiments. The specific implementation can be found in the method embodiments, which will not be repeated here.
[0199] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the system and device described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.
[0200] In addition, in the description of this embodiment, unless otherwise clearly specified and limited, the terms "installed", "connected", and "connected" should be understood in a broad sense, for example, it can be a fixed connection, a detachable connection, or an integral connection; it can be a mechanical connection or an electrical connection; it can be a direct connection or an indirect connection through an intermediate medium, or it can be the internal communication of two components. For those skilled in the art, the specific meanings of the above terms in this disclosure can be understood according to specific circumstances.
[0201] If the functions are implemented in the form of software functional units and sold or used as independent products, they can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present disclosure, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, which is stored in a storage medium and includes several instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present disclosure. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.
[0202] In the description of the present disclosure, it should be noted that the terms "center", "upper", "lower", "left", "right", "vertical", "horizontal", "inner", "outer", etc., indicating the orientation or positional relationship, are based on the orientation or positional relationship shown in the drawings, and are only for the convenience of describing the present disclosure and simplifying the description, rather than indicating or implying that the device or element referred to must have a specific orientation, be constructed and operated in a specific orientation, and therefore cannot be understood as a limitation of the present disclosure. In addition, the terms "first", "second", and "third" are used for descriptive purposes only, and cannot be understood as indicating or implying relative importance.
[0203] Finally, it should be noted that the above embodiments are only specific implementation methods of the present disclosure, which are used to illustrate the technical solutions of the present disclosure, rather than to limit them. The protection scope of the present disclosure is not limited thereto. Although the present disclosure is described in detail with reference to the above embodiments, those skilled in the art should understand that any person skilled in the art who is familiar with the technical field can still modify the technical solutions recorded in the above embodiments within the technical scope disclosed in the present disclosure, or can easily think of changes, or make equivalent replacements for some of the technical features therein; and these modifications, changes or replacements do not make the essence of the corresponding technical solutions deviate from the spirit and scope of the technical solutions of the present embodiments, and should be included in the protection scope of the present disclosure. Therefore, the protection scope of the present disclosure shall be based on the protection scope of the claims.
Claims
1. A method for processing model data, characterized in that: The method comprises: Classifying the target file set to obtain classified groups of files, wherein each file in the target file set is used to store point data of the three-dimensional model; Setting the mesh attributes of each group of files, wherein the mesh attributes are data sets constituting the mesh of the three-dimensional model; generating a projection matrix based on the mesh attributes of each group of files; Based on the projection matrix, the formats of the groups of files are converted to obtain model data in a target format corresponding to each file.
2. The method according to claim 1, characterized in that The step of converting the formats of the groups of files based on the projection matrix to obtain model data in a target format corresponding to each file includes: Constructing an initial mesh volume of each file based on the vertex position in each file of each group of files and the projection matrix; Obtaining vertex index data, normal information and texture mapping coordinates in each file of each group of files; According to the vertex index data in each file, the normal information in each file is written into the initial mesh of each file to obtain the mesh to be processed of each file; According to the vertex index data in each file, the texture map coordinates in each file are written into the to-be-processed mesh body of each file, and the model data in the target format corresponding to each file is obtained.
3. The method according to claim 2, characterized in that The step of constructing an initial mesh volume of each file based on the vertex position in each file of each group of files and the projection matrix comprises: Create an empty grid; Mapping the vertex position in each file in each group of files to a two-dimensional screen through the projection matrix to obtain the mapped vertex position; Performing an inverse matrix transformation of the projection matrix on the mapped vertex positions to obtain transformed vertex positions; Setting the transformed vertex positions to corresponding vertices in the empty mesh to obtain a mesh after constructing vertex information; Polygons are constructed based on the vertices in each file, and the constructed polygons are added to the mesh after the vertex information is constructed to obtain an initial mesh body of each file.
4. The method according to claim 2, characterized in that: The step of writing the normal information in each file into the initial mesh of each file according to the vertex index data in each file to obtain the mesh to be processed of each file includes: Create a normal layer of the initial mesh of each file and set the mode of the normal layer to obtain the first mesh of each file; Get the static array of the normal layer in the first mesh and the number of elements in each file; Adjusting the size of the static array based on the number of elements to obtain an adjusted static array; The normal information of each file is written into the corresponding vertices in the first mesh of each file according to the vertex index data of each file, and the normal information of each file is added to the corresponding position in the adjusted static array to obtain the mesh to be processed of each file.
5. The method according to claim 2, characterized in that: The step of writing the texture map coordinates in each file into the to-be-processed mesh body of each file according to the vertex index data in each file to obtain the model data in the target format corresponding to each file includes: Create a texture coordinate layer of the mesh to be processed in each file, and set the mode of the texture coordinate layer to obtain the second mesh in each file; Get the static array and index array of the normal layer in the second mesh, as well as the number of elements in each file; Adjust the sizes of the static array and the index array based on the number of elements to obtain an adjusted static array and an adjusted index array; The texture map coordinates of each file are written into the corresponding position in the adjusted static array, and the vertex index data of each file is added to the corresponding position in the adjusted index array to obtain the model data of the target format corresponding to each file.
6. The method according to claim 1, characterized in that The step of classifying the target file set to obtain the classified groups of files includes: Parse each file in the target file set to obtain the parsed file data; Based on the type of the parsed file data, each file in the target file set is classified to obtain each group of files after classification, wherein each file in each group of files has the same number of columns.
7. The method according to any one of claims 1 to 6, characterized in that: A graphical user interface is provided by a terminal device, wherein the graphical user interface comprises: The first set of components is used to trigger a classification instruction to classify a target file set; The second group of components is used to trigger the grid property setting instruction to set the grid property; The third group of components is used to trigger a matrix generation instruction to generate a projection matrix based on the grid attributes of each group of files; The fourth group of components is used to trigger the format conversion instruction to perform format conversion on each group of files.
8. The method according to claim 7, characterized in that The graphical user interface further includes: the fifth group component, which is used to trigger the attribute acquisition instruction to obtain the data attributes in each group of files after classification, and the step of setting the grid attributes of each group of files includes: Extracting data attributes from each group of files after classification by the fifth group of components, and displaying the extracted data attributes; In response to the triggering operation on the second group of components, obtaining the grid properties to be edited of each group of files; The grid properties to be edited are displayed through the second group of components.
9. A model data processing device, characterized in that: The model data processing device comprises: A classification module, used for classifying the target file set to obtain each group of classified files, wherein each file in the target file set is used to store point data of the three-dimensional model; Setting module, used for extracting module, used for extracting attributes of data in the classified file to obtain extracted data attributes; A generation module, used for generating a projection matrix based on the grid attributes of each group of files; The conversion module is used to perform format conversion on each group of files based on the projection matrix to obtain model data in a target format corresponding to each file.
10. An electronic device, characterized in that: The method comprises a processor and a memory, wherein the memory stores machine executable instructions that can be executed by the processor, and the processor executes the machine executable instructions to implement the method for processing model data according to any one of claims 1 to 8.
11. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions. When the computer-executable instructions are called and executed by a processor, the computer-executable instructions prompt the processor to implement the model data processing method according to any one of claims 1 to 8.
Citation Information
Patent Citations
File format conversion method and device and computer storage medium
CN114359461A
Map data conversion method and device, computer equipment and storage medium
CN115858644A
Construction method of space environment entity data file, electronic equipment and storage medium
CN117251410A
Method, device and equipment for fusing and converting data and readable storage medium
CN117743442A
Method for programmatic editing of text files
US20100218200A1