Method and apparatus for generating 3D model file, terminal device and storage medium

By writing initial file information into the 3D model file first, and then writing mesh and texture information in sequence, and storing data using a preset structure, the problems of file format incompatibility and low memory utilization are solved, achieving efficient data processing and low memory usage.

CN116483784BActive Publication Date: 2026-04-28SHENZHEN TATFOOK NETWORK TECH
View PDF 1 Cites 0 Cited by

Patent Information

Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
SHENZHEN TATFOOK NETWORK TECH
Filing Date
2023-03-06
Publication Date
2026-04-28

AI Technical Summary

Technical Problem

Existing 3D model file formats are incompatible with multiple file formats and cannot contain all model data, resulting in large file sizes and reduced memory space utilization and operational efficiency.

Method used

By first writing the initial file information, and then writing the mesh information and texture information in sequence, and using a preset structure for data storage, a model file is formed, ensuring the reasonable layout of data types in memory.

Benefits of technology

It improves the loading speed and operational efficiency of model files, while reducing memory usage and maintaining file compatibility.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN116483784B_ABST
    Figure CN116483784B_ABST
Patent Text Reader

Abstract

The application discloses a 3D model file generation method, comprising the following steps: obtaining a preset structure of a model file to be generated; obtaining inputted multi-type data from a preset path; wherein the multi-type data comprises initial file information, mesh information and texture information; writing the initial file information into a file header in the preset structure to obtain a first initial file; writing the mesh information into the first initial file to obtain a second initial file; and writing the texture information into the second initial file to obtain a model file. The data definition fully considers the storage layout of the data type in the memory, greatly improves the loading speed, improves the operation efficiency, and reduces the memory occupation of the model file. The application also discloses a 3D model file generation device, a terminal equipment and a computer readable storage medium, which have the above beneficial effects.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of model data processing technology, and in particular to methods, apparatus, terminal devices and storage media for generating 3D model files. Background Technology

[0002] With the continuous development of information technology, 3D (3D) modeling technology is applied to various industries to efficiently display image content. Furthermore, representing a 3D scene in a computer mainly involves rendering a set of mesh data. There are various methods for representing mesh data, resulting in many 3D model file formats, each with its own defined standards.

[0003] In related technologies, existing 3D model file formats are defined for specific use cases, cannot be compatible with multiple file formats, and cannot contain all the model data required for rendering in some modeling software. Furthermore, the large size of model files resulting from including comprehensive data reduces memory space utilization and also decreases the efficiency of manipulating the model.

[0004] Therefore, how to improve the efficiency of processing model files and improve performance utilization is a key issue of concern to those skilled in the art. Summary of the Invention

[0005] The purpose of this application is to provide a method, apparatus, terminal device, and storage medium for generating 3D model files, so as to reduce the space occupied by model files and improve the efficiency of data processing.

[0006] To address the aforementioned technical problems, this application provides a method for generating 3D model files, comprising:

[0007] Obtain the preset structure of the model file to be generated;

[0008] Multiple types of input data are obtained from a preset path; wherein, the multiple types of data include: initial file information, mesh information, and texture information;

[0009] The initial file information is written into the file header of the preset structure to obtain the first initial file;

[0010] The grid information is written into the first initial file to obtain the second initial file;

[0011] The texture information is written into the second initial file to obtain the model file.

[0012] Optionally, the grid information includes any one or more of the following:

[0013] Global information, vertex information, texture information, plugin point information, color information, transparency information, view information, vertex index information, geometry list information, rendering pass information, and bone information.

[0014] Optionally, the texture information includes any one or more of the following:

[0015] Texture animation information, particle effect information, and ribbon trigger information.

[0016] Optionally, multiple types of input data can be obtained from a preset path, including:

[0017] The user inputs the various types of data through the user interface.

[0018] Optional, also includes:

[0019] Determine whether the file header in the preset structure contains an identifier for animation information;

[0020] If so, the animation information is written into the model file to obtain a new model file; wherein, the animation information includes any one or more of the following: camera information, lighting information, animation list information, and individual animation information.

[0021] Optional, also includes:

[0022] When the model file is loaded, the initial file information, mesh information and texture information of the model file are read in sequence to form the corresponding memory data.

[0023] Optional, also includes:

[0024] The mesh information is rendered in batches using multiple rendering channels; wherein the maximum number of rendering index values ​​for each rendering channel is set to a maximum preset value.

[0025] This application also provides a 3D model file generation apparatus, comprising:

[0026] The structure acquisition module is used to acquire the preset structure of the model file to be generated.

[0027] A multi-type data acquisition module is used to acquire input multi-type data from a preset path; wherein, the multi-type data includes: initial file information, mesh information, and texture information;

[0028] The header information writing module is used to write the initial file information into the file header of the preset structure to obtain the first initial file;

[0029] A grid information writing module is used to write the grid information into the first initial file to obtain a second initial file;

[0030] The texture information writing module is used to write the texture information into the second initial file to obtain the model file.

[0031] This application also provides a terminal device, including:

[0032] Memory, used to store computer programs;

[0033] A processor for executing the computer program to implement the steps of the generation method as described above.

[0034] This application also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the steps of the generation method described above.

[0035] This application provides a method for generating a 3D model file, comprising: obtaining a preset structure of the model file to be generated; obtaining multiple types of input data from a preset path; wherein the multiple types of data include: initial file information, mesh information, and texture information; writing the initial file information into the file header of the preset structure to obtain a first initial file; writing the mesh information into the first initial file to obtain a second initial file; and writing the texture information into the second initial file to obtain a model file.

[0036] By first writing initial file information to the initial file, and then writing mesh information and texture information in sequence, the final model file is obtained. This achieves the goal of writing all the necessary information data, such as mesh information and texture information, into the file. The data definition fully considers the storage layout of data types in memory, which greatly improves the loading speed, can improve the efficiency of operation, and at the same time reduces the memory usage of the model file.

[0037] This application also provides a 3D model file generation device, a terminal device, and a computer-readable storage medium, which have the above-mentioned beneficial effects, and will not be elaborated here. Attached Figure Description

[0038] To more clearly illustrate the technical solutions in the embodiments of this application or the prior art, the drawings used in the description of the embodiments or the prior art will be briefly introduced below. Obviously, the drawings described below are only embodiments of this application. For those skilled in the art, other drawings can be obtained based on the provided drawings without creative effort.

[0039] Figure 1 A flowchart illustrating a method for generating a 3D model file provided in an embodiment of this application;

[0040] Figure 2A flowchart illustrating another method for generating 3D model files provided in this application embodiment;

[0041] Figure 3 A flowchart illustrating the model file reading process of another 3D model file generation method provided in this application embodiment;

[0042] Figure 4 This is a schematic diagram of the structure of a 3D model file generation device provided in an embodiment of this application. Detailed Implementation

[0043] The core of this application is to provide a method, apparatus, terminal device, and storage medium for generating 3D model files, so as to reduce the space occupied by model files and improve the efficiency of data processing.

[0044] To make the objectives, technical solutions, and advantages of the embodiments of this application clearer, the technical solutions of the embodiments of this application will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only some embodiments of this application, not all embodiments. Based on the embodiments of this application, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this application.

[0045] In related technologies, existing 3D model file formats are defined for specific use cases, cannot be compatible with multiple file formats, and cannot contain all the model data required for rendering in some modeling software. Furthermore, the large size of model files resulting from including comprehensive data reduces memory space utilization and also decreases the efficiency of manipulating the model.

[0046] Therefore, this application provides a method for generating 3D model files. By first writing initial file information into the initial file, and then writing mesh information and texture information in sequence, the final model file is obtained. This method realizes that all necessary information data such as mesh information and texture information are written into the file. The data definition fully considers the storage layout of data types in memory, which greatly improves the loading speed, improves the efficiency of operation, and reduces the memory occupation of the model file.

[0047] The following embodiment illustrates a method for generating 3D model files provided in this application.

[0048] Please refer to Figure 1 , Figure 1 This is a flowchart illustrating a method for generating a 3D model file, as provided in an embodiment of this application.

[0049] In this embodiment, the method may include:

[0050] S101, Obtain the preset structure of the model file to be generated;

[0051] This step aims to obtain the preset structure of the model file. The preset structure is the defined structure of the model file, which reduces the file size and improves compatibility. Because a non-exclusive file structure is used, other software can read and recognize it, thus improving compatibility.

[0052] S102, Obtain multi-type input data from a preset path; the multi-type data includes: initial file information, mesh information, and texture information;

[0053] Furthermore, this step may include:

[0054] Obtain various types of data input by the user through the user interface.

[0055] In other words, it involves acquiring multiple types of data input by the user.

[0056] S103, write the initial file information into the file header of the preset structure to obtain the first initial file;

[0057] As can be seen, this step aims to write the initial file information into the file header of the preset structure to obtain the first initial file. The initial file information mainly defines the model file. Generally, the basic information of the model file can be determined based on this initial file information.

[0058] S104, Write the mesh information into the first initial file to obtain the second initial file;

[0059] Building upon S103, this step aims to write the mesh information into the first initial file, resulting in the second initial file. The mesh information refers to the information representing the mesh in the model.

[0060] Furthermore, the grid information includes any one or more of the following:

[0061] Global information, vertex information, texture information, plugin point information, color information, transparency information, view information, vertex index information, geometry list information, rendering pass information, and bone information.

[0062] S105, Write the texture information into the second initial file to obtain the model file;

[0063] Building upon S104, this step aims to write the texture information into the second initial file, resulting in the third initial file. The texture information refers to the information representing the model texture in the model file.

[0064] The texture information includes one or more of the following: texture animation information, particle effect information, and ribbon trigger information.

[0065] Furthermore, in this embodiment, the initial file information, mesh information, and texture information can be written in the following order: first the initial file information, then the mesh information, and finally the texture information.

[0066] Furthermore, this embodiment may also include:

[0067] Determine whether the file header in the preset structure contains an identifier for animation information;

[0068] If so, write the animation information into the model file to obtain a new model file; the animation information includes any one or more of the following: camera information, lighting information, animation list information, and individual animation information.

[0069] As can be seen, the above optional solutions can also be used to add corresponding animation information to the model file.

[0070] Based on this model file, the rendering process in this embodiment may include:

[0071] When loading a model file, the initial file information, mesh information, and texture information of the model file are read in sequence and the corresponding memory data is formed.

[0072] The memory layout of the model file formed by the above steps will not occupy extra memory, so the file size will be very small. Furthermore, due to the unique loading order design, the data stream can be read from beginning to end once to parse all the information and include all the functions, so the reading speed is very fast.

[0073] Furthermore, multiple rendering channels are used to render the mesh information in batches; the maximum number of rendering index values ​​for each rendering channel is set to the maximum preset value.

[0074] In summary, this embodiment first writes initial file information to the initial file, and then sequentially writes mesh information, texture information, and animation information to obtain the final model file. This achieves the goal of writing all the necessary information data, such as mesh information, texture information, and animation information, into the file, maintaining the compatibility of the model file. At the same time, the order of writing the data information conforms to the operation flow of model data, which can improve the efficiency of operation and reduce the memory usage of the model file.

[0075] The following specific embodiment further illustrates a method for generating 3D model files provided in this application.

[0076] In this embodiment, the ParaX format (the model format in Paracraft 3D modeling software) is used as a specific implementation of the model file in this application. The ParaX file mainly includes the following data:

[0077] ParaX header definition:

[0078]

[0079]

[0080] The `id` and `version` are each composed of 4 characters (each character is 8 bits), representing the current ParaX version number. `type` and `nModelFormat` are used to distinguish between ParaX models and BMAX models, and `IsAnimated` is used to determine whether it contains animation data. `minExtent` and `maxExtent` represent the minimum and maximum 3D boundary data of the model, respectively, defining the bounding box data.

[0081] Secondly, ParaX model data definition:

[0082] 1) Textures:

[0083]

[0084] The main definitions include the texture data format, texture size, the number of textures stored in ParaX, and the path corresponding to each texture.

[0085] 2) Vertices:

[0086]

[0087]

[0088] The coordinates of the mesh vertices are defined to calculate the weight values, bone index values, normals corresponding to each coordinate value, texture coordinates, and finally the color value of the vertex itself.

[0089] 3) Indices:

[0090] The index value is represented using a set of 16-bit unsigned short data, and the maximum index value that can be represented is 65535.

[0091] 4) Geosets (geometry list information):

[0092]

[0093] Since the maximum index value for each vertex is 65535, when processing data larger than 65535, the model needs to be processed in batches, which involves dividing the model into multiple parts. A Geoset defines a Mesh number, vertex start number, number of vertices, corresponding index value number, and number of index values.

[0094] 5) RenderPasses:

[0095]

[0096]

[0097] In ParaX models, mesh data is rendered in batches using multiple RenderPasses. Each RenderPass renders a maximum of 65535 index values, which is the maximum value that an index value can represent. Using this data representation type allows for a more concise and efficient memory layout of the data, while using multiple RenderPasses can support models containing a large amount of data (more than 65535 vertex index values).

[0098] 6) Bones (skeleton information) and Animations (animation information)

[0099]

[0100]

[0101] The bone number, index value, and parent bone node index value are defined.

[0102]

[0103] The trans, rot, and scale parameters define the keyframe data for skeletal animation.

[0104] Based on the above definition of model files, please refer to... Figure 2 , Figure 2 This is a flowchart illustrating another method for generating 3D model files provided in an embodiment of this application.

[0105] In the process of generating ParaX files, each node is stored according to its defined size and structure, and a binary .x file is generated in the end.

[0106] Please refer to Figure 3 , Figure 3 This is a flowchart illustrating the model file reading process of another 3D model file generation method provided in this application embodiment.

[0107] During the loading of ParaX files, each node is read sequentially according to its defined size and structure, ultimately forming memory data for use by Paracraft (3D model files).

[0108] As can be seen, this embodiment first writes initial file information to the initial file, and then sequentially writes mesh information, texture information, and animation information to obtain the final model file. This achieves the goal of writing all necessary information data, such as mesh information, texture information, and animation information, into the file. Due to the use of a preset structure, the file reading process is universal, maintaining the compatibility of the model file. Furthermore, the order in which the data information is written conforms to the operational flow of model data, improving operational efficiency and reducing the memory footprint of the model file.

[0109] The following describes a 3D model file generation apparatus provided in the embodiments of this application. The 3D model file generation apparatus described below and the 3D model file generation method described above can be referred to in correspondence.

[0110] Please refer to Figure 4 , Figure 4 This is a schematic diagram of the structure of a 3D model file generation device provided in an embodiment of this application.

[0111] In this embodiment, the device may include:

[0112] The structure acquisition module 100 is used to acquire the preset structure of the model file to be generated.

[0113] The multi-type data acquisition module 200 is used to acquire input multi-type data from a preset path; wherein, the multi-type data includes: initial file information, mesh information and texture information;

[0114] The header information writing module 300 is used to write the initial file information into the file header in a preset structure to obtain the first initial file;

[0115] The mesh information writing module 400 is used to write mesh information into a first initial file to obtain a second initial file;

[0116] The texture information writing module 500 is used to write texture information into a second initial file to obtain a model file.

[0117] Grid information includes one or more of the following:

[0118] Global information, vertex information, texture information, plugin point information, color information, transparency information, view information, vertex index information, geometry list information, rendering pass information, and bone information.

[0119] Texture information includes one or more of the following:

[0120] Texture animation information, particle effect information, and ribbon trigger information.

[0121] Optionally, the multi-type data acquisition module 200 is specifically used to acquire multi-type data input by the user through the user operation interface.

[0122] Optionally, the device may also include:

[0123] The animation information addition module is used to determine whether there is an animation information identifier in the file header of the preset structure; if so, the animation information is written to the model file to obtain a new model file; wherein, the animation information includes any one or more of the following information: camera information, lighting information, animation list information, and individual animation information.

[0124] Optionally, the device may also include:

[0125] The file reading module is used to read the initial file information, mesh information and texture information of the model file in sequence when loading the model file, and form the corresponding memory data.

[0126] Optionally, the device may also include:

[0127] The mesh rendering module is used to render mesh information in batches using multiple rendering channels; the maximum number of rendering index values ​​for each rendering channel is set to the maximum preset value.

[0128] This application also provides a terminal device, including:

[0129] Memory, used to store computer programs;

[0130] A processor is configured to implement the steps of the generation method as described in the above embodiments when executing the computer program.

[0131] This application also provides a computer-readable storage medium storing a computer program, which, when executed by a processor, implements the steps of the generation method described in the above embodiments.

[0132] The various embodiments in this specification are described in a progressive manner, with each embodiment focusing on its differences from other embodiments. Similar or identical parts between embodiments can be referred to interchangeably. For the apparatus disclosed in the embodiments, since it corresponds to the method disclosed in the embodiments, the description is relatively simple; relevant parts can be referred to in the method section.

[0133] Those skilled in the art will further recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this application.

[0134] The steps of the methods or algorithms described in conjunction with the embodiments disclosed herein can be implemented directly by hardware, a software module executed by a processor, or a combination of both. The software module can be located in random access memory (RAM), main memory, read-only memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, removable disk, CD-ROM, or any other form of storage medium known in the art.

[0135] The foregoing has provided a detailed description of the method, apparatus, terminal device, and storage medium for generating 3D model files provided in this application. Specific examples have been used to illustrate the principles and implementation methods of this application. The descriptions of the embodiments above are merely for the purpose of helping to understand the method and core ideas of this application. It should be noted that those skilled in the art can make various improvements and modifications to this application without departing from its principles, and these improvements and modifications also fall within the protection scope of the claims of this application.

Claims

1. A method for generating 3D model files, characterized in that, include: Obtain the preset structure of the model file to be generated; The default structure uses a non-exclusive file structure; Multiple types of input data are obtained from a preset path; wherein, the multiple types of data include: initial file information, mesh information, and texture information; The initial file information is written into the file header of the preset structure to obtain the first initial file; The grid information is written into the first initial file to obtain the second initial file; The texture information is written into the second initial file to obtain the model file; When the model file is loaded, the initial file information, mesh information and texture information of the model file are read in sequence to form the corresponding memory data.

2. The generation method according to claim 1, characterized in that, The grid information includes any one or more of the following: Global information, vertex information, texture information, plugin point information, color information, transparency information, view information, vertex index information, geometry list information, rendering pass information, and bone information.

3. The generation method according to claim 1, characterized in that, The texture information includes any one or more of the following: Texture animation information, particle effect information, and ribbon trigger information.

4. The generation method according to claim 1, characterized in that, Retrieves multiple types of input data from a preset path, including: The user inputs the various types of data through the user interface.

5. The generation method according to claim 1, characterized in that, Also includes: Determine whether the file header in the preset structure contains an identifier for animation information; If so, the animation information is written into the model file to obtain a new model file; wherein, the animation information includes any one or more of the following: camera information, lighting information, animation list information, and individual animation information.

6. The generation method according to claim 1, characterized in that, Also includes: The mesh information is rendered in batches using multiple rendering channels; wherein the maximum number of rendering index values ​​for each rendering channel is set to a maximum preset value.

7. A device for generating 3D model files, characterized in that, include: The structure acquisition module is used to acquire the preset structure of the model file to be generated. The default structure uses a non-exclusive file structure; A multi-type data acquisition module is used to acquire input multi-type data from a preset path; wherein, the multi-type data includes: initial file information, mesh information, and texture information; The header information writing module is used to write the initial file information into the file header of the preset structure to obtain the first initial file; A grid information writing module is used to write the grid information into the first initial file to obtain a second initial file; The texture information writing module is used to write the texture information into the second initial file to obtain the model file; The file reading module is used to read the initial file information, mesh information and texture information of the model file in sequence when loading the model file, and form the corresponding memory data.

8. A terminal device, characterized in that, include: Memory, used to store computer programs; A processor for executing the computer program to implement the steps of the generation method as described in any one of claims 1 to 6.

9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the steps of the generation method as described in any one of claims 1 to 6.

Citation Information

Patent Citations

  • Storage file structure of electric power three-dimensional data

    CN110515900A