Three-dimensional model file storage method and device, electronic equipment, storage medium and computer program product
By segmenting and encoding the three-dimensional model, the existing three-dimensional model file format has been solved, and the file volume and cost are significantly reduced and the rendering and color expression of the model is ensured. .
Patent Information
- Application Number
- CN202411508419.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2024-10-28
- Publication Date
- 2025-02-14
AI Technical Summary
The existing three-dimensional model file format is large in size, resulting in high transmission and storage costs, especially in mobile devices and network transmission scenarios.
By dividing the three-dimensional model into blocks and block numbers of the blocks, the palette that stores the color RGB values is colored, and the color of the divided block corresponds to the color number, and the divided block is stored based on the block number and color number 3D model file.
It significantly reduces the size of the three-dimensional model file, reduces the transmission and storage costs, and ensures the renderability and color expressiveness of the model.
Smart Images

Figure CN119441520A_ABST
Abstract
Description
Technical Field
[0001] The present invention belongs to the technical field of three-dimensional models, and in particular, relates to a three-dimensional model file storage method, device, electronic equipment, storage medium and computer program product. Background Art
[0002] In recent years, with the rapid development of 3D printing technology and virtual reality technology, the storage and transmission of three-dimensional models have become particularly important. Traditional 3D model file formats are large in size and have high transmission and storage costs, especially in mobile devices and network transmission scenarios. Summary of the invention
[0003] In response to the problems existing in the prior art, the present invention provides a three-dimensional model file storage method, device, electronic device, storage medium and computer program product, which at least partially solve the problems existing in the prior art of large volume and high transmission and storage costs.
[0004] In a first aspect, an embodiment of the present disclosure provides a method for storing a three-dimensional model file, comprising: Divide the three-dimensional model into blocks and number the blocks; The color palette storing the color RGB values is numbered, and the colors of the blocks obtained by segmentation are matched with the color numbers; The segmented 3D model files are stored based on block numbers and color numbers.
[0005] Optionally, dividing the three-dimensional model into blocks includes: The three-dimensional model is pixelated, and the pixelated three-dimensional model is divided according to the size of pixel blocks.
[0006] Optionally, the color numbering of the color palette storing the color RGB values includes: Merge the colors of the 3D model.
[0007] Optionally, in the merging of the colors of the three-dimensional model, the colors are merged into 16 colors at most.
[0008] Optionally, storing the segmented 3D model file based on the block number and the color number includes: Use binary to store whether there is a pixel block at each block number.
[0009] In a second aspect, the embodiments of the present disclosure further provide a three-dimensional model rendering method, including: Create a block of any size and attach a material that can set the base color to the created block; Read the length, width and height of the model cube from the file stored by any of the three-dimensional model file storage methods described in the first aspect; Read the block's storage array in the stored file and create an instance of the block at the position where the storage array is 1.
[0010] In a third aspect, the present disclosure also provides a three-dimensional model rendering device, including: A segmentation module, used for segmenting the three-dimensional model into blocks and numbering the blocks; A color processing module is used to color-code the color palette storing the RGB values of the colors and to correspond the colors of the blocks obtained by segmentation to the color numbers; The storage module is used for storing the segmented 3D model files based on the block number and the color number.
[0011] In a third aspect, an embodiment of the present disclosure further provides an electronic device, the electronic device comprising: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute any three-dimensional model file storage method described in the first aspect.
[0012] In a fourth aspect, an embodiment of the present disclosure further provides a computer-readable storage medium, which stores computer instructions, and the computer instructions are used to enable a computer to execute any of the three-dimensional model file storage methods described in the first aspect.
[0013] In a fifth aspect, an embodiment of the present disclosure further provides a computer program product, including a computer program / instruction, which, when executed by a processor, implements any of the three-dimensional model file storage methods described in the first aspect.
[0014] The present invention provides a 3D model file storage method, device, electronic device, storage medium and computer program product, wherein the 3D model file storage method divides the 3D model and stores the 3D file based on the block coding and color coding after the division, thereby simplifying the stored data and reducing the storage file size of the 3D model, thereby achieving the purpose of reducing the volume, transmission cost and storage cost. BRIEF DESCRIPTION OF THE DRAWINGS
[0015] The above and other objects, features and advantages of the present disclosure will become more apparent through a more detailed description of exemplary embodiments of the present disclosure in conjunction with the accompanying drawings, wherein like reference numerals generally represent like components throughout the exemplary embodiments of the present disclosure.
[0016] Figure 1 A flowchart of a three-dimensional model file storage method provided by an embodiment of the present disclosure; Figure 2 A functional block diagram of a three-dimensional model file storage device provided in an embodiment of the present disclosure; Figure 3 A functional block diagram of an electronic device provided in an embodiment of the present disclosure. DETAILED DESCRIPTION
[0017] The embodiments of the present disclosure are described in detail below with reference to the accompanying drawings.
[0018] It should be clear that the following embodiments of the present disclosure are described by specific specific examples, and those skilled in the art can easily understand other advantages and effects of the present disclosure from the contents disclosed in this specification. Obviously, the described embodiments are only a part of the embodiments of the present disclosure, rather than all of the embodiments. The present disclosure can also be implemented or applied through other different specific embodiments, and the details in this specification can also be modified or changed in various ways based on different viewpoints and applications without departing from the spirit of the present disclosure. It should be noted that the following embodiments and features in the embodiments can be combined with each other in the absence of conflict. Based on the embodiments in the present disclosure, all other embodiments obtained by ordinary technicians in the field without making creative work are within the scope of protection of the present disclosure.
[0019] It should be noted that various aspects of the embodiments within the scope of the appended claims are described below. It should be apparent that the aspects described herein may be embodied in a wide variety of forms, and any specific structure and / or function described herein is merely illustrative. Based on the present disclosure, it should be understood by those skilled in the art that an aspect described herein may be implemented independently of any other aspect, and two or more of these aspects may be combined in various ways. For example, any number of aspects described herein may be used to implement the device and / or practice the method. In addition, other structures and / or functionalities other than one or more of the aspects described herein may be used to implement this device and / or practice this method.
[0020] It should also be noted that the illustrations provided in the following embodiments are only schematic illustrations of the basic concept of the present disclosure. The illustrations only show components related to the present disclosure rather than being drawn according to the number, shape and size of components in actual implementation. In actual implementation, the type, quantity and proportion of each component may be changed arbitrarily, and the component layout may also be more complicated.
[0021] Additionally, in the following description, specific details are provided to facilitate a thorough understanding of the examples. However, it will be understood by those skilled in the art that the aspects described may be practiced without these specific details.
[0022] For ease of understanding, Figure 1As shown, this embodiment discloses a 3D model file storage method, including: Step S101: dividing the three-dimensional model into blocks and numbering the blocks; Step S102: color numbering is performed on the color palette storing the color RGB values, and the colors of the divided blocks are matched with the color numbers; Step S103: storing the segmented 3D model file based on the block number and the color number.
[0023] Optionally, dividing the three-dimensional model into blocks includes: The three-dimensional model is pixelated, and the pixelated three-dimensional model is divided according to the size of pixel blocks.
[0024] Optionally, in the merging of the colors of the three-dimensional model, the colors are merged into 16 colors at most.
[0025] That is, in color merging, colors can be merged into 10, 12, 13, 14, 15 or 16 types, etc., but currently the maximum number of merged colors is 16. The more types are merged, the larger the data used for the palette color number.
[0026] Optionally, storing the segmented 3D model file based on the block number and the color number includes: Use binary to store whether there is a pixel block at each block number.
[0027] Optionally, the color numbering of the color palette storing the color RGB values includes: Merge the colors of the 3D model.
[0028] Correspondingly, this embodiment also discloses a three-dimensional model rendering method, including: Create a block of any size and attach a material that can set the base color to the created block; Reading the length, width and height of the model cube from the file stored based on the three-dimensional model file storage method disclosed in this embodiment; Read the block's storage array in the stored file and create an instance of the block at the position where the storage array is 1.
[0029] In a specific application scenario, Segmentation and encoding of pixelated models: The pixelated 3D model is divided into blocks according to the size of the pixel blocks, and each block is numbered. Binary storage is used to determine whether there is a pixel block on each block number, thereby reducing storage space.
[0030] Color Simplification and Palette: Simplify the color of the model and merge similar colors. Currently, a maximum of 16 colors are used. The RGB values of the colors are uniformly stored in the palette area, and the color of each square only stores the palette color number, which further compresses the file size.
[0031] The 3D model file format obtained by using the 3D model file storage method disclosed in this embodiment is called VXC format. VXC format significantly reduces the volume of the 3D model file while ensuring the renderability and color expression of the model.
[0032] Model rendering: Since the VXC file only defines the position of the cube, you can set the size of the cube mesh as needed when rendering. The specific steps are as follows:
[0033] Create a cube of any size and attach a material with a settable baseColor.
[0034] Read the length, width and height of the model cube from the VXC file (in blocks).
[0035] Read the bit array of the block in the VXC file and create a cube instance at the position where the bit is 1.
[0036] The structure of the VXC file is defined as follows, and parsed using the syntax of the imhex editor: #include<std / io.pat> struct header { u8x; u8 y; u8z; bool enable_colorlimit; u16 cube_len; u16 color_len; }; struct color_palatte { s32 color_palatte [[format_read("Read_Rgb")]]; }; bitfield color_idx { unsigned idx :4; }; struct color { float r; float a; float g; float b; }; bitfield bit { bool bit :1; }; fn GetRgb(s32 x) { color ret; ret.r = float(x) / 256 / 256 / 255; ret.a = float(x) / 256 / 256 / 255; ret.g = float(x / 256 % 256) / 255; ret.b = float(x % 256) / 255; return ret; }; fn Read_Rgb(s32 x) { color ret; ret.r = float(x) / 256 / 256 / 255; ret.a = float(x) / 256 / 256 / 255; ret.g = float(x / 256 % 256) / 255; ret.b = float(x % 256) / 255; return std::format("r:{:.3f} g:{:.3f} b:{:.3f}", ret.r, ret.g,ret.b); }; struct VoxelModel { header header; if(header.enable_colorlimit) { color_idx color_idx[(header.cube_len + 1) / 2 * 2]; color_palatte color_palatte
[16] ; } else { s16 color_idx[header.cube_len]; color_palatte color_palatte[header.color_len]; } bit bit[header.x * header.y * header.z]; }; VoxelModel voxelmodel_at_0x00 @ 0x00.
[0037] The VXC format of this embodiment can compress a 200KB voxel.glb model file to only 972B, greatly reducing the size of the model file. At the same time, the basic shape and color information of the model is retained, which is convenient for fast rendering and display on different platforms.
[0038] The three-dimensional model file storage method disclosed in this embodiment significantly reduces the size of the model file through pixel encoding and color simplification technology, is suitable for 3D printing, virtual reality and other fields, and has broad application prospects.
[0039] like Figure 2 As shown, this embodiment also discloses a three-dimensional model rendering device, including: A segmentation module, used for segmenting the three-dimensional model into blocks and numbering the blocks; A color processing module is used to color-code the color palette storing the RGB values of the colors and to correspond the colors of the blocks obtained by segmentation to the color numbers; The storage module is used for storing the segmented 3D model files based on the block number and the color number.
[0040] The electronic device disclosed in this embodiment includes a memory and a processor. The memory is used to store non-temporary computer-readable instructions. Specifically, the memory may include one or more computer program products, and the computer program product may include various forms of computer-readable storage media, such as volatile memory and / or non-volatile memory. The volatile memory may include, for example, a random access memory (RAM) and / or a cache memory (cache), etc. The non-volatile memory may include, for example, a read-only memory (ROM), a hard disk, a flash memory, etc.
[0041] The processor may be a central processing unit (CPU) or other forms of processing units with data processing capabilities and / or instruction execution capabilities, and may control other components in the electronic device to perform desired functions. In one embodiment of the present disclosure, the processor is used to run the computer-readable instructions stored in the memory, so that the electronic device performs all or part of the steps of the three-dimensional model file storage method of each embodiment of the present disclosure.
[0042] Those skilled in the art should be able to understand that in order to solve the technical problem of how to obtain a good user experience, the present embodiment may also include well-known structures such as a communication bus and an interface, and these well-known structures should also be included in the protection scope of the present disclosure.
[0043] like Figure 3 The present invention provides a schematic diagram of the structure of an electronic device according to an embodiment of the present invention, which is suitable for implementing the electronic device in the embodiment of the present invention. Figure 3 The electronic device shown is only an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0044] like Figure 3 As shown, the electronic device may include a processing device (such as a central processing unit, a graphics processing unit, etc.), which can perform various appropriate actions and processes according to a program stored in a read-only memory (ROM) or a program loaded from a storage device into a random access memory (RAM). In the RAM, various programs and data required for the operation of the electronic device are also stored. The processing device, ROM, and RAM are connected to each other through a bus. The input / output (I / O) interface is also connected to the bus.
[0045] Typically, the following devices can be connected to the I / O interface: input devices such as sensors or visual information acquisition devices; output devices such as display screens; storage devices such as tapes, hard disks, etc.; and communication devices. The communication device allows the electronic device to communicate with other devices (such as edge computing devices) wirelessly or by wire to exchange data. Figure 3 An electronic device having various devices is shown, but it should be understood that it is not required to implement or possess all the devices shown. More or fewer devices may be implemented or possessed instead.
[0046] In particular, according to an embodiment of the present disclosure, the process described above with reference to the flowchart can be implemented as a computer software program. For example, an embodiment of the present disclosure includes a computer program product, which includes a computer program carried on a non-transitory computer-readable medium, and the computer program contains program code for executing the method shown in the flowchart. In such an embodiment, the computer program can be downloaded and installed from a network through a communication device, or installed from a storage device, or installed from a ROM. When the computer program is executed by a processing device, all or part of the steps of the three-dimensional model file storage method of the embodiment of the present disclosure are executed.
[0047] For detailed description of this embodiment, reference may be made to the corresponding descriptions in the aforementioned embodiments, which will not be repeated here.
[0048] The computer-readable storage medium disclosed in this embodiment stores non-transitory computer-readable instructions. When the non-transitory computer-readable instructions are executed by a processor, all or part of the steps of the three-dimensional model file storage method of each embodiment of the present disclosure are executed.
[0049] The above-mentioned computer-readable storage media include, but are not limited to: optical storage media (e.g., CD-ROM and DVD), magneto-optical storage media (e.g., MO), magnetic storage media (e.g., magnetic tape or mobile hard disk), media with built-in rewritable non-volatile memory (e.g., memory card) and media with built-in ROM (e.g., ROM box).
[0050] For detailed description of this embodiment, reference may be made to the corresponding descriptions in the aforementioned embodiments, which will not be repeated here.
[0051] The basic principles of the present disclosure are described above in conjunction with specific embodiments. However, it should be noted that the advantages, strengths, effects, etc. mentioned in the present disclosure are only examples and not limitations, and it cannot be considered that these advantages, strengths, effects, etc. are required by each embodiment of the present disclosure. In addition, the specific details disclosed above are only for the purpose of illustration and ease of understanding, and are not limitations. The above details do not limit the present disclosure to the necessity of adopting the above specific details to be implemented.
[0052] In the present disclosure, relational terms such as first and second, etc. are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply that there is any such actual relationship or order between these entities or operations. The block diagrams of the devices, devices, equipment, and systems involved in the present disclosure are only illustrative examples and are not intended to require or imply that they must be connected, arranged, and configured in the manner shown in the block diagram. As will be appreciated by those skilled in the art, these devices, devices, equipment, and systems can be connected, arranged, and configured in any manner. Words such as "including", "comprising", "having", etc. are open words, referring to "including but not limited to", and can be used interchangeably with them. The words "or" and "and" used here refer to the words "and / or" and can be used interchangeably with them, unless the context clearly indicates otherwise. The words "such as" used here refer to the phrase "such as but not limited to", and can be used interchangeably with them.
[0053] Additionally, as used herein, "or" used in a list of items beginning with "at least one" indicates a separate list, so that, for example, a list of "at least one of A, B, or C" means A or B or C, or AB or AC or BC, or ABC (i.e., A and B and C). Furthermore, the word "exemplary" does not mean that the example described is preferred or better than other examples.
[0054] It should also be noted that in the system and method of the present disclosure, each component or each step can be decomposed and / or recombined. Such decomposition and / or recombination should be regarded as equivalent solutions of the present disclosure.
[0055] Various changes, substitutions, and modifications of the techniques described herein may be made without departing from the teachings defined by the appended claims. Furthermore, the scope of the claims of the present disclosure is not limited to the specific aspects of the processes, machines, manufactures, compositions of events, means, methods, and actions described above. Currently existing or later to be developed processes, machines, manufactures, compositions of events, means, methods, or actions that perform substantially the same functions or achieve substantially the same results as the corresponding aspects described herein may be utilized. Thus, the appended claims include such processes, machines, manufactures, compositions of events, means, methods, or actions within their scope.
[0056] The above description of the disclosed aspects is provided to enable any person skilled in the art to make or use the present disclosure. Various modifications to these aspects will be readily apparent to those skilled in the art, and the general principles defined herein may be applied to other aspects without departing from the scope of the present disclosure. Therefore, the present disclosure is not intended to be limited to the aspects shown herein, but rather to the widest scope consistent with the principles and novel features disclosed herein.
[0057] The above description has been given for the purpose of illustration and description. In addition, this description is not intended to limit the embodiments of the present disclosure to the forms disclosed herein. Although multiple example aspects and embodiments have been discussed above, those skilled in the art will recognize certain variations, modifications, changes, additions and sub-combinations thereof.
Claims
1. A three-dimensional model file storage method, characterized in that: include: Divide the three-dimensional model into blocks and number the blocks; The color palette storing the color RGB values is numbered, and the colors of the blocks obtained by segmentation are matched with the color numbers; The segmented 3D model files are stored based on block numbers and color numbers.
2. The three-dimensional model file storage method according to claim 1, characterized in that: The step of dividing the three-dimensional model into blocks comprises: The three-dimensional model is pixelated, and the pixelated three-dimensional model is divided according to the size of pixel blocks.
3. The three-dimensional model file storage method according to claim 1, characterized in that: The color numbering of the color palette storing the color RGB values comprises: Merge the colors of the 3D model.
4. The three-dimensional model file storage method according to claim 3, characterized in that: In the merging of the colors of the three-dimensional model, at most 16 colors are merged.
5. The three-dimensional model file storage method according to claim 1, characterized in that: The method of storing the segmented three-dimensional model file based on the block number and the color number includes: Use binary to store whether there is a pixel block at each block number.
6. A three-dimensional model rendering method, characterized in that: include: Create a block of any size and attach a material that can set the base color to the created block; Reading the length, width and height of the model cube from a file stored in the three-dimensional model file storage method according to any one of claims 1 to 5; Read the block's storage array in the stored file and create an instance of the block at the position where the storage array is 1.
7. A three-dimensional model file storage device, characterized in that: include: A segmentation module, used for segmenting the three-dimensional model into blocks and numbering the blocks; A color processing module is used to color-code the color palette storing the RGB values of the colors and to correspond the colors of the blocks obtained by segmentation to the color numbers; The storage module is used for storing the segmented 3D model files based on the block number and the color number.
8. An electronic device, characterized in that: The electronic device comprises: at least one processor; and, a memory communicatively connected to the at least one processor; wherein, The memory stores instructions that can be executed by the at least one processor, and the instructions are executed by the at least one processor so that the at least one processor can execute the three-dimensional model file storage method described in any one of claims 1-5.
9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer instructions, and the computer instructions are used to enable a computer to execute the three-dimensional model file storage method described in any one of claims 1-5.
10. A computer program product comprising a computer program / instructions, characterized in that When the computer program / instruction is executed by a processor, the three-dimensional model file storage method described in any one of claims 1-5 is implemented.