A method and apparatus for processing a three-dimensional model
By compressing the texture image of the 3D model to generate the target model file, the problem of large data volume of the 3D model is solved, storage and transmission efficiency is improved, and rendering burden is reduced.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- BEIJING YOUZHUJU NETWORK TECH CO LTD
- Filing Date
- 2022-03-31
- Publication Date
- 2026-07-14
Smart Images

Figure CN116932495B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of three-dimensional model processing technology, and in particular to a method and apparatus for processing three-dimensional models. Background Technology
[0002] With the development of computer graphics, more and more scientific applications require the analysis and display of 3D models of objects. For example, 3D models are used to display organs in the medical field, to realize the movement of virtual characters in film and television production, and to analyze geological structures in geological exploration.
[0003] A 3D model is a polygonal representation of an object, which can be a real-world entity or a virtual object. Unlike displaying objects based on 2D images, displaying objects based on 3D models allows for viewing the object from any perspective according to user needs, resulting in a more detailed and realistic representation. However, because 3D models contain a lot of object information, their data size is generally large. This large data size brings many inconveniences to the storage, transmission, and rendering of 3D models. Therefore, reducing the data size of 3D models is an urgent problem to be solved. Summary of the Invention
[0004] In view of this, embodiments of the present invention provide a method and apparatus for processing three-dimensional models, used to reduce the amount of data in three-dimensional models.
[0005] To achieve the above objectives, the embodiments of the present invention provide the following technical solutions:
[0006] In a first aspect, embodiments of the present invention provide a method for processing a three-dimensional model, comprising:
[0007] The model file of the 3D model to be processed is parsed to obtain the texture image and model description file of the 3D model to be processed;
[0008] The texture image is compressed to obtain a compressed texture image;
[0009] The target model file corresponding to the 3D model to be processed is generated based on the compressed texture image and the model description file.
[0010] As an optional implementation of this invention, the model description file includes: a model texture description file and a structure description file; before generating the target model file corresponding to the 3D model to be processed based on the compressed texture image and the model description file, the method further includes:
[0011] Obtain the attribute information of the 3D model to be processed;
[0012] Based on the attribute information, delete at least one of the following texture images from the compressed texture image: diffuse texture image, normal texture image, ambient occlusion texture image, specular texture image, and lighting texture image, and delete the reference to the deleted compressed texture image in the model texture description file.
[0013] As an optional implementation of this invention, the attribute information of the three-dimensional model to be processed includes: the reflectivity of the three-dimensional model to be processed and the light source type of the three-dimensional model to be processed; the step of deleting at least one texture image from the diffuse texture image, normal texture image, ambient occlusion texture image, specular texture image, and illumination texture image in the compressed texture image according to the attribute information includes:
[0014] If the reflectivity of the 3D model to be processed is less than the threshold reflectivity, and the light source type of the 3D model to be processed is a preset light source type, then delete the other texture images in the compressed texture image except for the diffuse texture image.
[0015] As an optional implementation of this invention, the attribute information of the three-dimensional model to be processed includes: the reflectivity of the three-dimensional model to be processed and the light source type of the three-dimensional model to be processed; the step of deleting at least one texture image from the diffuse texture image, normal texture image, ambient occlusion texture image, specular texture image, and illumination texture image in the compressed texture image according to the attribute information includes:
[0016] If the reflectivity of the 3D model to be processed is greater than or equal to the threshold reflectivity, and the light source type of the 3D model to be processed is a preset light source type, delete the other texture images in the compressed texture image except for the diffuse texture image, the normal texture image, and the specular texture image.
[0017] As an optional implementation of this invention, before parsing the model file of the 3D model to be processed to obtain the texture image and model description file of the 3D model to be processed, the method further includes:
[0018] Determine whether the model file of the 3D model to be processed is a model file of the first format;
[0019] If the model file of the 3D model to be processed is not a model file in the first format, then the model file of the 3D model to be processed is converted into a model file in the first format.
[0020] As an optional implementation of this invention, when the model file of the 3D model to be processed is a model file in a second format, the step of converting the model file of the 3D model to be processed into a model file in the first format includes:
[0021] Convert the model file in the second format into a compressed file in the preset compression format;
[0022] The compressed file is decompressed to obtain the texture image of the 3D model to be processed and the model description file in the second format;
[0023] The second format model description file is converted into the first format model description file using a preset script;
[0024] Based on the texture image of the 3D model to be processed and the model description file in the first format, a model file of the 3D model to be processed in the first format is generated.
[0025] As an optional implementation of this invention, the step of performing image compression processing on the texture image to obtain a compressed texture image includes:
[0026] The data bits occupied by each pixel value in the texture image are compressed from a first number to a second number to obtain the compressed texture image;
[0027] Wherein, the first quantity is greater than the second quantity.
[0028] As an optional implementation of this invention, before parsing the model file of the 3D model to be processed and obtaining the texture image and model description file of the 3D model to be processed, the method further includes:
[0029] A target image set is obtained, which includes multiple images of the target object acquired from different perspectives, and each image in the target image set has depth information;
[0030] A three-dimensional model of the target object is constructed based on the target image set, and the three-dimensional model to be processed is obtained.
[0031] As an optional implementation of this invention, the method further includes:
[0032] The product display interface includes display controls for displaying the 3D model to be processed.
[0033] In response to the operation of the display control, the target model file is obtained, and the 3D model to be processed is displayed according to the target model file.
[0034] Secondly, embodiments of the present invention provide a three-dimensional model processing apparatus, comprising:
[0035] The parsing unit is used to parse the model file of the 3D model to be processed, and obtain the texture image and model description file of the 3D model to be processed;
[0036] A compression unit is used to perform image compression processing on the texture image to obtain a compressed texture image;
[0037] The generation unit is used to generate a target model file corresponding to the three-dimensional model to be processed based on the compressed texture image and the model description file.
[0038] As an optional implementation of this invention, the model description file includes: a model texture description file and a structure description file; the three-dimensional model processing device further includes:
[0039] The acquisition unit is used to acquire the attribute information of the three-dimensional model to be processed before the generation unit generates the target model file corresponding to the three-dimensional model to be processed based on the compressed texture image and the model description file.
[0040] The processing unit deletes at least one of the diffuse texture image, normal texture image, ambient occlusion texture image, specular texture image, and lighting texture image from the compressed texture image according to the attribute information, and deletes the reference to the deleted compressed texture image in the model texture description file.
[0041] As an optional implementation of the present invention, the attribute information of the three-dimensional model to be processed includes: the reflectivity of the three-dimensional model to be processed and the light source type of the three-dimensional model to be processed;
[0042] The processing unit is specifically used to delete other texture images in the compressed texture image, except for the diffuse texture image, when the reflectivity of the three-dimensional model to be processed is less than the threshold reflectivity and the light source type of the three-dimensional model to be processed is a preset light source type.
[0043] As an optional implementation of the present invention, the attribute information of the three-dimensional model to be processed includes: the reflectivity of the three-dimensional model to be processed and the light source type of the three-dimensional model to be processed;
[0044] The processing unit is specifically used to delete other texture images in the compressed texture image, except for the diffuse texture image, the normal texture image, and the specular texture image, when the reflectivity of the three-dimensional model to be processed is greater than or equal to the threshold reflectivity and the light source type of the three-dimensional model to be processed is a preset light source type.
[0045] As an optional implementation of this invention, the three-dimensional model processing device further includes:
[0046] The format conversion unit is used to determine whether the model file of the three-dimensional model to be processed is a model file of the first format before the parsing unit parses the model file of the three-dimensional model to be processed and obtains the texture image and model description file of the three-dimensional model to be processed, and to convert the model file of the three-dimensional model to be processed into a model file of the first format if the model file of the three-dimensional model to be processed is not a model file of the first format.
[0047] As an optional implementation of this invention, when the model file of the 3D model to be processed is a model file in a second format, the format conversion unit is specifically used to convert the model file in the second format into a compressed file in a preset compression format; decompress the compressed file to obtain the texture image of the 3D model to be processed and the model description file in the second format; convert the model description file in the second format into a model description file in the first format using a preset script; and generate a model file of the 3D model to be processed in the first format based on the texture image of the 3D model to be processed and the model description file in the first format.
[0048] As an optional implementation of the present invention, the compression unit is specifically used to compress the data bits occupied by each pixel value in the texture image from a first number to a second number to obtain the compressed texture image;
[0049] Wherein, the first quantity is greater than the second quantity.
[0050] As an optional implementation of this invention, the three-dimensional model processing device further includes:
[0051] The model building unit is used to obtain a target image set and construct a three-dimensional model of the target object based on the target image set before the parsing unit parses the model file of the three-dimensional model to be processed and obtains the texture image and model description file of the three-dimensional model to be processed.
[0052] The target image set includes multiple images acquired from different perspectives of the target object, and each image in the target image set has depth information.
[0053] As an optional implementation of this invention, the three-dimensional model processing device further includes:
[0054] A display unit is used to display a product display interface, the product display interface including display controls for displaying the 3D model to be processed; in response to the operation of the display controls, the target model file is obtained, and the 3D model to be processed is displayed according to the target model file.
[0055] Thirdly, embodiments of the present invention provide an electronic device, including: a memory and a processor, wherein the memory is used to store a computer program; and the processor is used to cause the electronic device to implement the three-dimensional model processing method described in any of the above embodiments when executing the computer program.
[0056] Fourthly, embodiments of the present invention provide a computer-readable storage medium that, when executed by a computing device, causes the computing device to implement the three-dimensional model processing method described in any of the above embodiments.
[0057] Fifthly, embodiments of the present invention provide a computer program product that, when run on a computer, enables the computer to implement the three-dimensional model processing method described in any of the above embodiments.
[0058] The method for processing 3D models provided in this embodiment of the invention first parses the model file of the 3D model to be processed to obtain the texture image and model description file of the 3D model to be processed. Then, it performs image compression processing on the texture image of the 3D model to be processed to obtain a compressed texture image. Finally, it generates the target model file corresponding to the 3D model to be processed based on the compressed texture image and the model description file. Since this embodiment of the invention can parse the texture image of the 3D model to be processed and perform image compression processing on the texture image, this embodiment of the invention can reduce the data volume of the texture image of the 3D model, thereby reducing the data volume of the 3D model. Attached Figure Description
[0059] The accompanying drawings, which are incorporated in and form part of this specification, illustrate embodiments consistent with the invention and, together with the description, serve to explain the principles of the invention.
[0060] To more clearly illustrate the technical solutions in the embodiments of the present invention or the prior art, the accompanying drawings that need to be called in the description of the embodiments or the prior art will be briefly introduced below. Obviously, for those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0061] Figure 1 One of the flowcharts of the three-dimensional model processing method provided in the embodiments of the present invention;
[0062] Figure 2 The second flowchart of the three-dimensional model processing method provided in the embodiments of the present invention;
[0063] Figure 3 One of the structural schematic diagrams of a three-dimensional model processing device provided in an embodiment of the present invention;
[0064] Figure 4 A second schematic diagram of the structure of the three-dimensional model processing device provided in an embodiment of the present invention;
[0065] Figure 5 A third schematic diagram of the structure of the three-dimensional model processing device provided in an embodiment of the present invention;
[0066] Figure 6 Fourth schematic diagram of the structure of the three-dimensional model processing device provided in the embodiments of the present invention;
[0067] Figure 7 Fourth schematic diagram of the structure of the three-dimensional model processing device provided in the embodiments of the present invention;
[0068] Figure 8 This is a schematic diagram of the hardware structure of an electronic device provided in an embodiment of the present invention. Detailed Implementation
[0069] To better understand the above-mentioned objectives, features, and advantages of the present invention, the solutions of the present invention will be further described below. It should be noted that, unless otherwise specified, the embodiments of the present invention and the features thereof can be combined with each other.
[0070] Many specific details are set forth in the following description in order to provide a full understanding of the invention, but the invention may also be practiced in other ways different from those described herein; obviously, the embodiments in the specification are only some embodiments of the invention, and not all embodiments.
[0071] In embodiments of the present invention, the terms "exemplary" or "for example" are used to indicate that something is an example, illustration, or description. Any embodiment or design described as "exemplary" or "for example" in embodiments of the present invention should not be construed as being more preferred or advantageous than other embodiments or designs. Specifically, the use of the terms "exemplary" or "for example" is intended to present the relevant concepts in a specific manner. Furthermore, in the description of embodiments of the present invention, unless otherwise stated, "a plurality of" means two or more.
[0072] The execution subject of the 3D model processing method provided in this application embodiment can be a mobile phone, tablet computer, laptop computer, ultra-mobile personal computer (UMPC), netbook, personal digital assistant (PDA), smartwatch, smart bracelet, etc., or the execution subject of the 3D model processing method can also be other types of devices, which are not limited in this application embodiment.
[0073] This invention provides a method for processing three-dimensional models, referring to... Figure 1 As shown, the processing method for this 3D model includes the following steps S11 to S13:
[0074] S11. Parse the model file of the 3D model to be processed to obtain the texture image and model description file of the 3D model to be processed.
[0075] In this embodiment of the invention, the 3D model to be processed can be a 3D model of any object. For example, in the scenario of e-commerce product display, the 3D model to be processed can be a 3D model of physical objects such as clothes, shoes, cups, cats, and dogs; as another example, in the scenarios of film and television production, game production, and special effects development, the 3D model to be processed can be a 3D model of virtual objects such as game characters, film and television characters, and virtual clothing. This embodiment of the invention does not limit this.
[0076] Analysis of the 3D model files reveals two main data components: The first is the texture image, which can include at least one of the following: bump mapping, reflection mapping, ambient occlusion mapping, specular map, and light mapping. The second is the model description file, which defines the vertices, normals, texture coordinates, and surface texture attributes of each polygon. The form and format of the model description file vary depending on the 3D model file format. For example, in a USDZ (Universal Scene Description Zip) format 3D model file, the model description file is a single USDZ format model description file. In contrast, in an OBJ (Object) format 3D model file, the model description file is divided into two parts. One part is the model texture description file, which is used to define the surface texture attributes of the 3D model, such as defining the material, lighting, and color of the 3D model's surface. The other part is the model structure description file, which is used to define the vertices, normals, and texture coordinates of each polygon in the form of a vertex list.
[0077] S12. Perform image compression processing on the texture image to obtain a compressed texture image.
[0078] The embodiments of the present invention can use any image compression processing algorithm to compress the texture image of the three-dimensional model to be processed. For example, the image compression processing algorithms such as linear interpolation algorithm, window function algorithm, and region average interpolation algorithm can be used to compress the texture image of the three-dimensional model to be processed.
[0079] Furthermore, the compression ratio for image compression processing of the texture image can be set based on actual needs, such as making the data volume of the compressed texture image 80% or 50% of the original texture image data volume, etc.
[0080] As an optional implementation of this invention, step S12 (performing image compression processing on the texture image to obtain a compressed texture image) includes:
[0081] The data bits occupied by each pixel value in the texture image are compressed from a first number to a second number to obtain the compressed texture image;
[0082] Wherein, the first quantity is greater than the second quantity.
[0083] For example, the first quantity and the second quantity are 24 and 8, respectively. That is, each pixel value of the original texture image occupies 24 data bits, while each pixel value of the compressed texture image occupies 8 data bits. The data size of the compressed texture image is 1 / 3 of the data size of the original texture image.
[0084] Optionally, the texture image can be compressed using the pngquant tool to obtain the compressed texture image.
[0085] Specifically, Pngquant is a command-line tool for compressing images. It can convert 24 / 32-bit PNG files to 8 / 16-bit PNG files, thereby reducing image size with almost no impact on image quality.
[0086] Since the pngquant tool can compress images with almost no impact on image quality, using pngquant to compress the texture image can reduce the amount of data of the 3D model being processed without affecting its display effect.
[0087] S13. Generate the target model file corresponding to the 3D model to be processed based on the compressed texture image and the model description file.
[0088] As an optional implementation of this invention, step S13 (generating the target model file corresponding to the 3D model to be processed based on the compressed texture image and the model description file) includes:
[0089] The compressed texture image and the model description file are compressed into a compressed file of a preset format to generate the target model file corresponding to the 3D model to be processed.
[0090] For example, the compressed texture image and the model description file are compressed into a ZIP format compressed file (a file with the extension .zip) to generate the target model file corresponding to the 3D model to be processed.
[0091] The method for processing 3D models provided in this embodiment of the invention first parses the model file of the 3D model to be processed to obtain the texture image and model description file of the 3D model to be processed. Then, it performs image compression processing on the texture image of the 3D model to be processed to obtain a compressed texture image. Finally, it generates the target model file corresponding to the 3D model to be processed based on the compressed texture image and the model description file. Since this embodiment of the invention can parse the texture image of the 3D model to be processed and perform image compression processing on the texture image, this embodiment of the invention can reduce the data volume of the texture image of the 3D model, thereby reducing the data volume of the 3D model.
[0092] As an extension and refinement of the above embodiments, this invention provides another method for processing three-dimensional models, referring to... Figure 2 As shown, the processing method for this 3D model includes the following steps:
[0093] S201. Determine whether the model file of the three-dimensional model to be processed is a model file of the first format.
[0094] For example, the first format can be OBJ format. OBJ format is a standard 3D model file format, a file format developed for workstation-based 3D modeling and animation software, and has the characteristic of being universally compatible across multiple platforms.
[0095] If, in step S201 above, it is determined that the model file of the 3D model to be processed is not a model file of the first format, then step S202 and subsequent steps are executed.
[0096] S202. Convert the model file of the three-dimensional model to be processed into a model file in the first format.
[0097] As an optional implementation of this invention, when the model file of the three-dimensional model to be processed is a model file in the second format, the implementation of step S202 may include the following steps a and d:
[0098] Step a: Convert the model file in the second format into a compressed file in a preset compressed format.
[0099] For example, the second format can be USDZ format. USDZ format is another standard 3D model file format, the main feature of which is that it only supports running on the iOS operating system and has the suffix .usdz.
[0100] For example, the preset compression format is ZIP, Z7, etc., but this embodiment of the invention does not limit it.
[0101] As an optional implementation of this invention, step a (converting the model file of the second format into a compressed file of a preset compression format) includes:
[0102] The file extension of the model file in the second format is changed to the file extension of the compressed file in the preset compression format, so as to convert the model file of the 3D model to be processed into a compressed file in the preset compression format.
[0103] For example, when the second format is USDZ format and the preset compression format is ZIP format, since the file extension of the 3D model in USDZ format is .usdz and the file extension of the compressed file in the preset compression format is .zip, changing the file extension of the 3D model to be processed to the file extension of the compressed file in the preset compression format includes: changing the file extension of the 3D model to be processed from .usdz to .zip.
[0104] Step b: Decompress the compressed file to obtain the texture image of the 3D model to be processed and the model description file in the second format.
[0105] When the first format is OBJ and the second format is USDZ, the 3D model file in USDZ format mainly includes: a texture image of the 3D model and a model description file in USDZ format; the 3D model file in OBJ format mainly includes: a texture image of the 3D model and a model description file in OBJ format. The texture image in USDZ format is similar in format and function to the texture image in OBJ format, and the model description file in USDZ format is similar in function to the model description file in OBJ format. The difference is that the model description file in USDZ format is in USDZ format, while the model description file in OBJ format consists of two parts: one part is in OBJ format, and the other part is in MTL (Material Library File) format.
[0106] Step c: Convert the model description file in the second format to the model description file in the first format using a preset script.
[0107] Specifically, the Software Development Kit (SDK) can convert the model description file in the first format into the model description file in the second format. Therefore, the SDK can be used to write the preset script in the embodiments of the present invention, and the model description file can be converted into the model description file in the second format through the preset script.
[0108] Step d: Generate a model file of the three-dimensional model to be processed in the first format based on the texture image of the three-dimensional model to be processed and the model description file in the first format.
[0109] Similarly, the texture image of the 3D model to be processed and the model description file can be compressed into a compressed file of a preset format to generate a model file of the 3D model to be processed in the first format.
[0110] In step S201 above, if it is determined that the model file of the three-dimensional model to be processed is a model description file of the first format, then step S202 above is skipped, and step S203 below is executed directly.
[0111] S203. Parse the model file of the 3D model to be processed to obtain the texture image and model description file of the 3D model to be processed.
[0112] S204. Perform image compression processing on the texture image to obtain a compressed texture image.
[0113] The implementation methods for steps S203 and S204 above can be referred to Figure 1 The implementation methods of steps S11 and S12 in the illustrated embodiment will not be repeated here to avoid repetition.
[0114] S205. Obtain the attribute information of the three-dimensional model to be processed.
[0115] For example, attribute information may include: the reflectivity of the 3D model and the light source type of the 3D model.
[0116] S206. Delete at least one of the diffuse texture image, normal texture image, ambient occlusion texture image, specular texture image, and lighting texture image from the compressed texture image according to the attribute information, and delete the reference to the deleted compressed texture image in the model texture description file.
[0117] As an optional implementation of this invention, the attribute information of the three-dimensional model to be processed includes: the reflectivity of the three-dimensional model to be processed and the light source type of the three-dimensional model to be processed. Step S206 includes:
[0118] If the reflectivity of the 3D model to be processed is less than the threshold reflectivity, and the light source type of the 3D model to be processed is a preset light source type, then delete the other texture images in the compressed texture image except for the diffuse texture image.
[0119] For example, the preset light source type can be natural light. That is, when the reflectivity of the 3D model to be processed is low and the light source type is natural light, only the diffuse texture image of the compressed texture image is retained, and other texture images are deleted.
[0120] As an optional implementation of this invention, the attribute information of the three-dimensional model to be processed includes: the reflectivity of the three-dimensional model to be processed and the light source type of the three-dimensional model to be processed. Step S206 includes:
[0121] If the reflectivity of the 3D model to be processed is greater than or equal to the threshold reflectivity, and the light source type of the 3D model to be processed is a preset light source type, delete the other texture images in the compressed texture image except for the diffuse texture image, the normal texture image, and the specular texture image.
[0122] Similarly, the preset light source type can be natural light. That is, when the reflectivity of the 3D model to be processed is high and the light source type is natural light, only the diffuse texture image of the compressed texture image, the normal texture image, and the specular texture image are retained, while other texture images are deleted.
[0123] S207. Generate the target model file corresponding to the three-dimensional model to be processed based on the compressed texture image and the model description file.
[0124] Since the embodiments of the present invention can further delete at least one texture image in the texture image of the three-dimensional model to be processed according to the attribute information of the three-dimensional model to be processed, the embodiments of the present invention can further reduce the amount of data of the three-dimensional model.
[0125] As an optional implementation of this invention, before step S11 (parse the model file of the 3D model to be processed to obtain the texture image and model description file of the 3D model to be processed), the 3D model processing method provided in this invention further includes:
[0126] Construct the three-dimensional model to be processed.
[0127] As an optional implementation of this invention, the method of constructing the three-dimensional model to be processed includes the following steps 1 and 2:
[0128] Step 1: Obtain the target image set.
[0129] The target image set includes multiple images acquired from different perspectives of the target object, and each image in the target image set has depth information.
[0130] The embodiments of the present invention do not limit the implementation method of obtaining the target image set. The target image set can be obtained by image acquisition devices of mobile phones, computers, handheld computers, etc., or by downloading the target image set from the Internet, image libraries, etc.
[0131] Step 2: Construct a 3D model of the target object based on the target image set to obtain the 3D model to be processed.
[0132] For example, in e-commerce shopping scenarios, merchants or e-commerce platforms can use image acquisition devices such as mobile phones, computers, PDAs, and digital cameras to capture images of the products to be listed for sale from different perspectives, obtaining a set of images corresponding to the products; then, they can construct a 3D model of the products using the set of images, so that the products can be displayed on the product display page using the 3D model, allowing shoppers to have a more comprehensive understanding of the products.
[0133] For example, in the context of cultural relic research, researchers can use image acquisition devices such as mobile phones, computers, PDAs, and digital cameras to collect images of cultural relics from different perspectives and obtain a set of images corresponding to the cultural relics. Then, they can construct a three-dimensional model of the cultural relics using the set of images, so that researchers can observe and study the cultural relics more comprehensively and in detail on electronic devices.
[0134] The above are merely illustrative examples. The three-dimensional model processing method provided in this embodiment of the invention can also be used to construct three-dimensional models of other objects in other fields, such as constructing three-dimensional models of organs in the medical field, constructing three-dimensional models of geological structures in the geological research field, etc. This embodiment of the invention does not limit these applications, and the construction of three-dimensional models using the three-dimensional model processing method provided in this embodiment of the invention shall be taken as the standard.
[0135] As an optional implementation of this invention, the step of constructing a three-dimensional model of the target object based on the target image set to obtain the three-dimensional model to be processed includes:
[0136] The target image set is sent to a 3D model building server, and the 3D model of the target object sent by the 3D model building server is received to obtain the 3D model to be processed.
[0137] As an optional implementation of this invention, constructing a three-dimensional model of the target object based on the target image set to obtain the three-dimensional model to be processed may include the following steps:
[0138] Step 1: Trigger cloud construction via API call.
[0139] Step 2: Utilize the capabilities of the 3D model building platform cloud to establish a communication link between the model building platform and the terminal device.
[0140] Step 3: Configure the script for the 3D model building process on the 3D model building platform.
[0141] Step 4: The terminal device automatically downloads or captures the target image set and obtains the script for the 3D model building process from the 3D model building platform.
[0142] Step 5: Based on the target image set and the script for the 3D model construction process, construct the 3D model.
[0143] As an optional implementation of the present invention, the three-dimensional model processing method provided by the present invention further includes the following steps ① and ②:
[0144] Step 1: Display the product showcase interface.
[0145] The product display interface includes display controls for displaying the 3D model to be processed.
[0146] Step 2: In response to the operation of the display control, obtain the target model file, and display the 3D model to be processed according to the target model file.
[0147] That is, a display control can be added to the product display interface to trigger the display of the product's 3D model. When the user's operation on the display control is received, the target model file corresponding to the product's 3D model file is obtained, and then the product's 3D model is displayed according to the target model file.
[0148] It should be noted that the three-dimensional model processing method provided in this embodiment of the invention can also be used to display other three-dimensional models in other display scenarios, such as displaying three-dimensional models of cultural relics in museums, or displaying three-dimensional models of items that need to be explained in the classroom.
[0149] As an implementation of the above method, this embodiment of the invention also provides a three-dimensional model processing device, which corresponds to the aforementioned method embodiment. For ease of reading, this embodiment will not repeat the details of the aforementioned method embodiment one by one, but it should be clear that the three-dimensional model processing device in this embodiment can implement all the contents of the aforementioned method embodiment.
[0150] This invention provides a three-dimensional model processing device. Figure 3 This is a schematic diagram of the processing device for the 3D model, as shown below. Figure 3 As shown, the 3D model processing device 300 includes:
[0151] The parsing unit 31 is used to parse the model file of the three-dimensional model to be processed, and obtain the texture image and model description file of the three-dimensional model to be processed;
[0152] Compression unit 32 is used to perform image compression processing on the texture image to obtain a compressed texture image;
[0153] The generation unit 33 is used to generate a target model file corresponding to the three-dimensional model to be processed based on the compressed texture image and the model description file.
[0154] As an optional implementation of the present invention, refer to Figure 4 As shown, the three-dimensional model processing device 300 further includes:
[0155] The acquisition unit 34 is used to acquire the attribute information of the three-dimensional model to be processed before the parsing unit 31 generates the target model file corresponding to the three-dimensional model to be processed based on the compressed texture image and the model description file.
[0156] The processing unit 35 deletes at least one of the diffuse texture image, normal texture image, ambient occlusion texture image, specular texture image and illumination texture image in the compressed texture image according to the attribute information, and deletes the reference to the deleted compressed texture image in the model description file.
[0157] As an optional implementation of the present invention, the attribute information of the three-dimensional model to be processed includes: the reflectivity of the three-dimensional model to be processed and the light source type of the three-dimensional model to be processed;
[0158] The processing unit 35 is specifically used to delete other texture images in the compressed texture image, except for the diffuse texture image, when the reflectivity of the three-dimensional model to be processed is less than the threshold reflectivity and the light source type of the three-dimensional model to be processed is a preset light source type.
[0159] As an optional implementation of the present invention, the attribute information of the three-dimensional model to be processed includes: the reflectivity of the three-dimensional model to be processed and the light source type of the three-dimensional model to be processed;
[0160] The processing unit 35 is specifically used to delete other texture images in the compressed texture image, except for the diffuse texture image, the normal texture image and the specular texture image, when the reflectivity of the three-dimensional model to be processed is greater than or equal to the threshold reflectivity and the light source type of the three-dimensional model to be processed is a preset light source type.
[0161] As an optional implementation of the present invention, refer to Figure 5 As shown, the three-dimensional model processing device 300 further includes:
[0162] The format conversion unit 36 is used to determine whether the model file of the three-dimensional model to be processed is a model file of the first format before the parsing unit 31 parses the model file of the three-dimensional model to be processed to obtain the texture image and model description file of the three-dimensional model to be processed, and to convert the model file of the three-dimensional model to be processed into a model file of the first format if the model file of the three-dimensional model to be processed is not a model file of the first format.
[0163] As an optional implementation of this invention, when the model file of the three-dimensional model to be processed is a model file in a second format, the format conversion unit 36 is specifically used to convert the model file in the second format into a compressed file in a preset compression format; decompress the compressed file to obtain the texture image of the three-dimensional model to be processed and the model description file in the second format; convert the model description file in the second format into a model description file in the first format through a preset script; and generate a model file of the three-dimensional model to be processed in the first format based on the texture image of the three-dimensional model to be processed and the model description file in the first format.
[0164] As an optional implementation of the present invention, the compression unit 32 is specifically used to compress the data bits occupied by each pixel value in the texture image from a first number to a second number in order to obtain the compressed texture image;
[0165] Wherein, the first quantity is greater than the second quantity.
[0166] As an optional implementation of the present invention, refer to Figure 6 As shown, the three-dimensional model processing device further includes:
[0167] The model building unit 37 is used to obtain a target image set and construct a three-dimensional model of the target object based on the target image set before parsing the model file of the three-dimensional model to be processed and obtaining the texture image and model description file of the three-dimensional model to be processed.
[0168] The target image set includes multiple images acquired from different perspectives of the target object, and each image in the target image set has depth information.
[0169] As an optional implementation of the present invention, refer to Figure 7As shown, the three-dimensional model processing device 300 further includes:
[0170] Display unit 38 displays a product display interface, which includes display controls for displaying the 3D model to be processed, and in response to operations on the display controls, obtains the target model file and displays the 3D model to be processed based on the target model file.
[0171] The three-dimensional model processing device provided in this embodiment can execute the three-dimensional model processing method provided in the above method embodiment. Its implementation principle and technical effect are similar, and will not be described again here.
[0172] Based on the same inventive concept, embodiments of the present invention also provide an electronic device. Figure 8 This is a schematic diagram of the structure of an electronic device provided in an embodiment of the present invention, such as... Figure 8 As shown, the electronic device provided in this embodiment includes a memory 801 and a processor 802. The memory 801 is used to store computer programs; the processor 802 is used to execute the three-dimensional model processing method provided in the above embodiment when executing the computer program.
[0173] Based on the same inventive concept, embodiments of the present invention also provide a computer-readable storage medium storing a computer program, which, when executed by a processor, causes the computing device to implement the three-dimensional model processing method provided in the above embodiments.
[0174] Based on the same inventive concept, this embodiment of the invention also provides a computer program product, which, when run on a computer, enables the computing device to implement the three-dimensional model processing method provided in the above embodiments.
[0175] Those skilled in the art will understand that embodiments of the present invention can be provided as methods, systems, or computer program products. Therefore, the present invention can take the form of a completely hardware embodiment, a completely software embodiment, or an embodiment combining software and hardware aspects. Furthermore, the present invention can take the form of a computer program product implemented on one or more computer-usable storage media containing computer-usable program code.
[0176] The processor can be a Central Processing Unit (CPU), or other general-purpose processors, digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components, etc. A general-purpose processor can be a microprocessor or any conventional processor.
[0177] Memory may include non-persistent memory in computer-readable media, such as random access memory (RAM) and / or non-volatile memory, like read-only memory (ROM) or flash RAM. Memory is an example of computer-readable media.
[0178] Computer-readable media include both permanent and non-permanent, removable and non-removable storage media. Storage media can store information using any method or technology; the information can be computer-readable instructions, data structures, program modules, or other data. Examples of computer storage media include, but are not limited to, phase-change memory (PRAM), static random access memory (SRAM), dynamic random access memory (DRAM), other types of random access memory (RAM), read-only memory (ROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other memory technologies, CD-ROM, digital versatile optical disc (DVD) or other optical storage, magnetic tape, disk storage or other magnetic storage devices, or any other non-transferable medium that can be used to store information accessible by a computing device. As defined herein, computer-readable media do not include transient computer-readable media, such as modulated data signals and carrier waves.
[0179] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, and not to limit them; although the present invention has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that modifications can still be made to the technical solutions described in the foregoing embodiments, or equivalent substitutions can be made to some or all of the technical features; and these modifications or substitutions do not cause the essence of the corresponding technical solutions to deviate from the scope of the technical solutions of the embodiments of the present invention.
Claims
1. A method for processing three-dimensional models, characterized in that, include: The model file of the 3D model to be processed is parsed to obtain the texture image and model description file of the 3D model to be processed; The texture image is compressed to obtain a compressed texture image; Based on the compressed texture image and the model description file, a target model file corresponding to the 3D model to be processed is generated; Before generating the target model file corresponding to the 3D model to be processed based on the compressed texture image and the model description file, the method further includes: If the reflectivity of the 3D model to be processed is less than the threshold reflectivity, and the light source type of the 3D model to be processed is a preset light source type, delete the other texture images in the compressed texture image except for the diffuse texture image. If the reflectivity of the 3D model to be processed is greater than or equal to the threshold reflectivity, and the light source type of the 3D model to be processed is a preset light source type, then delete the other texture images in the compressed texture image except for the diffuse texture image, normal texture image, and specular texture image.
2. The method according to claim 1, characterized in that, Before parsing the model file of the 3D model to be processed to obtain the texture image and model description file of the 3D model to be processed, the method further includes: Determine whether the model file of the 3D model to be processed is a model file of the first format; If the model file of the 3D model to be processed is not a model file in the first format, then the model file of the 3D model to be processed is converted into a model file in the first format.
3. The method according to claim 2, characterized in that, When the model file of the 3D model to be processed is a model file in the second format, the step of converting the model file of the 3D model to be processed into a model file in the first format includes: Convert the model file in the second format into a compressed file in the preset compression format; The compressed file is decompressed to obtain the texture image of the 3D model to be processed and the model description file in the second format; The second format model description file is converted into the first format model description file using a preset script; Based on the texture image of the 3D model to be processed and the model description file in the first format, a model file of the 3D model to be processed in the first format is generated.
4. The method according to any one of claims 1-3, characterized in that, The step of performing image compression processing on the texture image to obtain a compressed texture image includes: The data bits occupied by each pixel value in the texture image are compressed from a first number to a second number to obtain the compressed texture image; Wherein, the first quantity is greater than the second quantity.
5. The method according to any one of claims 1-3, characterized in that, Before parsing the model file of the 3D model to be processed and obtaining the texture image and model description file of the 3D model to be processed, the method further includes: A target image set is obtained, which includes multiple images acquired from different perspectives of the target object, and each image in the target image set has depth information; A three-dimensional model of the target object is constructed based on the target image set to obtain the three-dimensional model to be processed.
6. The method according to any one of claims 1-3, characterized in that, The method further includes: The product display interface includes display controls for displaying the 3D model to be processed. In response to the operation of the display control, the target model file is obtained, and the 3D model to be processed is displayed according to the target model file.
7. A three-dimensional model processing device, characterized in that, include: The parsing unit is used to parse the model file of the 3D model to be processed, and obtain the texture image and model description file of the 3D model to be processed; A compression unit is used to perform image compression processing on the texture image to obtain a compressed texture image; The generation unit is used to generate a target model file corresponding to the three-dimensional model to be processed based on the compressed texture image and the model description file; The compression unit is further configured to, before generating the target model file corresponding to the three-dimensional model to be processed based on the compressed texture image and the model description file, delete other texture images in the compressed texture image except for the diffuse texture image when the reflectivity of the three-dimensional model to be processed is less than the threshold reflectivity and the light source type of the three-dimensional model to be processed is a preset light source type; and delete other texture images in the compressed texture image except for the diffuse texture image, the normal texture image, and the specular texture image when the reflectivity of the three-dimensional model to be processed is greater than or equal to the threshold reflectivity and the light source type of the three-dimensional model to be processed is a preset light source type.
8. An electronic device, characterized in that, include: A memory and a processor, the memory being used to store a computer program; the processor being used, when executing the computer program, to cause the electronic device to implement the method for processing a three-dimensional model as described in any one of claims 1-6.
9. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a computing device, causes the computing device to implement the three-dimensional model processing method according to any one of claims 1-6.
10. A computer program product, characterized in that, When the computer program product is run on a computer, the computer enables the computer to implement the three-dimensional model processing method as described in any one of claims 1-6.
Citation Information
Patent Citations
Real-time precise recognition method for vehicle number board
CN101383003A
Apparatus and method for volume processing and rendering
US20040125103A1