Method and device for texture mapping unfolding of voxel model, electronic device, and medium
By obtaining the four sides of the outer surface of the voxel model and determining and splicing the coordinates of the texture map blocks, the problem of cumbersome texture map expansion steps in the prior art is solved, and efficient and accurate texture map expansion is achieved.
Patent Information
- Application Number
- CN202210515659.5
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-05-12
- Publication Date
- 2025-06-24
- Estimated Expiration
- 2042-05-12
AI Technical Summary
The prior art has cumbersome steps to unfold texture maps on voxel models, long production time, and requires manual evaluation of the size of the pixel grid map used, which is prone to errors and causes rework and other problems.
By obtaining the four sides of the outer surface of the voxel model, determining the coordinates of the texture map surface blocks based on their three-dimensional coordinates, and stitching them in combination with the orientation to generate a texture map image, and finally arranging the image into the pixel grid map.
It realizes the automatic generation of expanded texture maps of voxel models, which improves generation efficiency and accuracy, ensures the consistency of texture map blocks, and avoids errors in manual operations.
Smart Images

Figure CN114782606B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of computer technology, and in particular, to a method and device for texture mapping unfolding of a voxel model, an electronic device, and a medium. Background Art
[0002] The production of a three-dimensional object (such as a three-dimensional game character) can be divided into a model production process and a rendering process. Among them, the model production process is further divided into: constructing a three-dimensional model of the three-dimensional object, texture mapping unfolding (also known as splitting texture mapping), and texture mapping production process.
[0003] The three-dimensional model of the constructed three-dimensional object can be a voxel model, and a voxel model is a three-dimensional model composed of multiple cubes. For texture mapping unfolding of the voxel model, it is required that the size of the texture mapping grid in the obtained unfolded texture mapping is equal to the size of one pixel of the pixel grid map. Among them, each four-sided face of the cube constituting the voxel model corresponds to a texture mapping patch, which is a texture mapping grid.
[0004] In the related art, texture mapping unfolding of a voxel model includes the following steps: Step 1, manually select the edges of the voxel model and perform segmentation to obtain the texture mapping images of each face of the voxel model; Step 2, manually place the texture mapping images of each face horizontally and vertically to determine the number of texture mapping grids included in each texture mapping image; Step 3, manually evaluate the size of the texture mapping required for the voxel model, and based on the evaluation result, determine the background size of the texture mapping. Manually place each texture mapping image into the determined pixel grid map, and make each texture mapping grid correspond to one pixel in the pixel grid map to obtain the unfolded texture mapping of the voxel model.
[0005] It can be seen that the steps of texture mapping unfolding of the voxel model in the related art are cumbersome, the production time is long, and it is necessary to manually evaluate the size of the pixel grid map used, which is prone to errors and leads to problems such as rework.
[0006] It should be noted that the information disclosed in the above background art section is only used to enhance the understanding of the background of the present disclosure. Therefore, it may include information that does not constitute the prior art known to those of ordinary skill in the art. Summary of the Invention
[0007] In view of the above problems, the present application is proposed to provide a method and device for texture mapping unfolding of a voxel model, an electronic device, and a medium that overcome the above problems or at least partially solve the above problems, including:
[0008] A method for texture mapping unfolding of a voxel model, the method includes:
[0009] Obtain the target four-sided faces included in the outer surface of the voxel model to be processed;
[0010] Determining texture coordinates of a texture map face block corresponding to the target quadrilateral in the unfolded texture map according to the three-dimensional coordinates of the target quadrilateral in the voxel model;
[0011] Based on the texture mapping coordinates of the texture mapping surface blocks in the unfolded texture map and the orientation of the target quadrilateral on the voxel model, the texture mapping surface blocks corresponding to the target quadrilaterals with the same orientation are spliced into texture mapping images corresponding to the outer surfaces of the voxel model respectively;
[0012] The texture map image is arranged in a pixel grid map to obtain an unfolded texture map of the voxel model, wherein each texture map face block in the texture map image corresponds to a pixel in the pixel grid map.
[0013] Optionally, the voxel model is composed of a plurality of cubes, each cube having six quadrilateral faces, and the step of obtaining the target quadrilateral faces included in the outer surface of the voxel model to be processed comprises:
[0014] Determine the four sides of the cube that do not overlap with the four sides of other cubes as target four sides constituting the outer surface of the voxel model;
[0015] or,
[0016] The overlapping four sides of the multiple cubes are removed to obtain the target four sides constituting the outer surface of the voxel model.
[0017] Optionally, determining the texture mapping coordinates of the texture mapping surface block corresponding to the target quadrilateral in the unfolded texture mapping according to the three-dimensional coordinates of the target quadrilateral in the voxel model includes:
[0018] Obtaining the three-dimensional coordinates of the geometric vertices of the target quadrilateral;
[0019] According to the three-dimensional coordinates of the geometric vertices, the texture mapping coordinates of the texture mapping surface block corresponding to the target quadrilateral in the unfolded texture mapping are determined.
[0020] Optionally, determining the texture mapping coordinates of the texture mapping surface block corresponding to the target quadrilateral in the unfolded texture mapping according to the three-dimensional coordinates of the geometric vertices includes:
[0021] The three-dimensional coordinates of the geometric vertices are converted into floating-point coordinates, and the texture mapping coordinates of the texture mapping surface blocks corresponding to the target quadrilaterals in the unfolded texture map are determined based on the floating-point coordinates.
[0022] Optionally, splicing the texture map patches corresponding to the target quadrilateral faces with the same orientation into texture map images respectively corresponding to the outer surfaces of the voxel model based on the texture map coordinates of the texture map patches in the unfolded texture map and the orientation of the target quadrilateral faces on the voxel model, includes:
[0023] Sort the texture map patches according to the texture map coordinates of the texture map patches in the unfolded texture map to obtain the serial numbers of the texture map patches;
[0024] Divide the texture map patches corresponding to the target quadrilateral faces with the same orientation into the same set according to the orientation of the target quadrilateral faces on the voxel model;
[0025] For the texture map patches in each set, splice the texture map patches in the same set according to the serial numbers of the texture map patches to obtain a texture map image.
[0026] Optionally, the method further includes:
[0027] Determine a pixel grid map according to the number of texture map patches of the voxel model, and the number of pixels of the pixel grid map is not less than the number of texture map patches.
[0028] Optionally, arranging the texture map image into the pixel grid map to obtain the unfolded texture map of the voxel model; includes:
[0029] Obtain a first pixel grid map;
[0030] When the number of pixels of the first pixel grid map is less than the number of texture map patches, obtain a second pixel grid map from the pixel grid map library, and arrange the texture map image into the second pixel grid map to obtain the unfolded texture map of the voxel model; the number of pixels of the second pixel grid map is not less than the number of texture map patches;
[0031] When the number of pixels of the first pixel grid map is not less than the number of texture map patches, arrange the texture map image into the first pixel grid map.
[0032] Optionally, arranging the texture map image into the pixel grid map to obtain the unfolded texture map of the voxel model; includes:
[0033] Arrange the texture map image into the pixel grid map at a specified interval to obtain the unfolded texture map of the voxel model.
[0034] A texture map unfolding device for a voxel model, the device includes:
[0035] A target quadrilateral surface acquisition module, configured to acquire target quadrilateral surfaces included in an outer surface of a voxel model to be processed;
[0036] A texture mapping surface block generation module, configured to determine texture mapping coordinates of a texture mapping surface block corresponding to the target quadrilateral surface in an unfolded texture mapping according to three-dimensional coordinates of the target quadrilateral surface in the voxel model;
[0037] A texture mapping image generation module, configured to splice texture mapping surface blocks corresponding to target quadrilateral surfaces with the same orientation into texture mapping images respectively corresponding to the outer surface of the voxel model based on the texture mapping coordinates of the texture mapping surface blocks in the unfolded texture mapping and the orientation of the target quadrilateral surfaces on the voxel model;
[0038] An unfolded texture mapping generation module, configured to arrange the texture mapping images in a pixel grid map to obtain the unfolded texture mapping of the voxel model, where each texture mapping surface block in the texture mapping image corresponds to a pixel in the pixel grid map.
[0039] Optionally, the voxel model is composed of multiple cubes, each cube has six quadrilateral surfaces, and the target quadrilateral surface acquisition module is configured to determine, as target quadrilateral surfaces constituting the outer surface of the voxel model, quadrilateral surfaces among the quadrilateral surfaces of the cubes that do not coincide with quadrilateral surfaces of other cubes; or configured to remove the coincident quadrilateral surfaces between multiple cubes to obtain target quadrilateral surfaces constituting the outer surface of the voxel model.
[0040] Optionally, the texture mapping surface block generation module includes:
[0041] A first acquisition module, configured to acquire three-dimensional coordinates of geometric vertices of the target quadrilateral surface;
[0042] A texture mapping coordinate determination module, configured to determine texture mapping coordinates of a texture mapping surface block corresponding to the target quadrilateral surface in the unfolded texture mapping according to the three-dimensional coordinates of the geometric vertices.
[0043] Optionally, the texture mapping coordinate determination module is configured to convert the three-dimensional coordinates of the geometric vertices into floating-point coordinates, and determine texture mapping coordinates of a texture mapping surface block corresponding to the target quadrilateral surface in the unfolded texture mapping based on the floating-point coordinates.
[0044] Optionally, the texture mapping image generation module includes:
[0045] A sorting module, configured to sort the texture mapping surface blocks according to the texture mapping coordinates of the texture mapping surface blocks in the unfolded texture mapping to obtain serial numbers of the texture mapping surface blocks;
[0046] A classification module, configured to divide the texture map patches corresponding to the target quadrilateral faces with the same orientation into the same set according to the orientation of the target quadrilateral faces on the voxel model;
[0047] A splicing module, configured to splice the texture map patches in each set according to the serial numbers of the texture map patches to obtain a texture map image.
[0048] Optionally, the apparatus further includes:
[0049] A grid map determination module, configured to determine a pixel grid map according to the number of texture map patches of the voxel model, and the number of pixels of the pixel grid map is not less than the number of texture map patches.
[0050] Optionally, the unfolded texture map generation module includes:
[0051] A grid map acquisition module, configured to acquire a first pixel grid map;
[0052] A first generation module, configured to, when the number of pixels of the first pixel grid map is less than the number of texture map patches, acquire a second pixel grid map from a pixel grid map library and arrange the texture map image in the second pixel grid map to obtain the unfolded texture map of the voxel model; the number of pixels of the second pixel grid map is not less than the number of texture map patches;
[0053] A second generation module, configured to, when the number of pixels of the first pixel grid map is not less than the number of texture map patches, arrange the texture map image in the first pixel grid map.
[0054] Optionally, the unfolded texture map generation module is configured to arrange the texture map image in the pixel grid map at a specified interval to obtain the unfolded texture map of the voxel model.
[0055] An electronic device, including a processor, a memory, and a computer program stored on the memory and capable of running on the processor, where when the computer program is executed by the processor, the steps of the method for unfolding the texture map of the voxel model as described above are implemented.
[0056] A computer-readable storage medium, on which a computer program is stored, where when the computer program is executed by a processor, the steps of the method for unfolding the texture map of the voxel model as described above are implemented.
[0057] This application has the following advantages:
[0058] In the embodiments of the present application, by obtaining the target quadrilateral faces included in the outer surface of the voxel model to be processed, determining the texture mapping coordinates of the texture mapping patches corresponding to the target quadrilateral faces in the unfolded texture mapping according to the three-dimensional coordinates of the target quadrilateral faces in the voxel model, combining the orientations of the target quadrilateral faces on the voxel model, splicing the texture mapping patches corresponding to the target quadrilateral faces with the same orientation into texture mapping images respectively corresponding to the outer surface of the voxel model, and finally arranging the texture mapping images into the pixel grid map in the manner of one pixel corresponding to each texture mapping patch in the pixel grid map, the unfolded texture mapping of the voxel model is obtained; it can realize the automatic generation of the unfolded texture mapping of the voxel model. At the same time, since in the process of generating the unfolded texture mapping of the voxel model in the embodiments of the present application, the texture mapping patches corresponding to the target quadrilateral faces that make up the outer surface of the voxel model are obtained first, and then the texture mapping images are obtained through splicing. Therefore, it can also ensure the consistency of the texture mapping patches in the texture mapping images, solving the problems in the prior art that the texture mapping patches obtained by manual segmentation are inconsistent, and the unfolded texture mapping is obtained by manually placing the texture mapping patches, resulting in inaccurate and low-efficiency unfolded texture mapping. The embodiments of the present application improve the efficiency and accuracy of generating the unfolded texture mapping. BRIEF DESCRIPTION OF THE DRAWINGS
[0059] In order to more clearly illustrate the technical solutions of the present application, the accompanying drawings required for the description of the present application will be briefly introduced below. Obviously, the accompanying drawings in the following description are only some embodiments of the present application. For those of ordinary skill in the art, other drawings can be obtained based on these drawings without creative efforts.
[0060] Figure 1 It is a flowchart of the steps of a method for unfolding the texture mapping of a voxel model according to an embodiment of the present application;
[0061] Figure 2 It is a schematic diagram of the voxel model to be processed according to an embodiment of the present application;
[0062] Figure 3 is Figure 2 a schematic diagram of the texture mapping patches obtained after unfolding the texture mapping of the target quadrilateral faces of the voxel model shown;
[0063] Figure 4 It is a schematic diagram of splicing the texture mapping patches to obtain a texture mapping image;
[0064] Figure 5 is Figure 2 a schematic diagram of the unfolded texture mapping of the voxel model shown;
[0065] Figure 6The structural block diagram of a texture mapping unfolding device for a voxel model according to an embodiment of the present application. Detailed implementation manners
[0066] To make the above objects, features, and advantages of the present application more obvious and understandable, the present application will be further described in detail below with reference to the accompanying drawings and specific implementation manners. Obviously, the described embodiments are part of the embodiments of the present application, rather than all of the embodiments. All other embodiments obtained by those of ordinary skill in the art based on the embodiments in the present application without creative efforts shall fall within the protection scope of the present application.
[0067] A voxel model is a model that represents a three-dimensional object by an ordered combination of a large number of regular voxels (such as cubes). During the production process of the voxel model, a texture mapping unfolding process is involved. The texture mapping is the UV texture mapping. UV is the abbreviation of the UV texture mapping coordinates. Similar to the X, Y, and Z axes of the spatial model, it defines the position information of each point on the texture mapping, and these points are related to the voxel model to determine the position of the surface texture mapping. UV accurately corresponds each point on the texture mapping to the surface of the voxel model. In the process of texture mapping unfolding of the voxel model in the related art, it is necessary to manually select the segmentation edges to obtain the texture mapping images of each surface of the voxel model. Then, through manual operations, the texture mapping patches (also called texture mapping meshes) included in each texture mapping image are determined, and the size of the mapping required for the voxel model is evaluated to determine the size of the pixel grid map of the mapping. Among them, the pixel grid map is a checkerboard background map generated by alternating black and white grids representing the size of a pixel, and it is also called the mapping background; finally, each texture mapping image is manually placed into the determined pixel grid map. During the placement process, it is ensured that each texture mapping patch in the texture mapping image corresponds to a pixel in the pixel grid map to obtain the unfolded texture mapping of the voxel model. The whole process is cumbersome, the production time is long, and it is necessary to manually evaluate the size of the mapping used, which is prone to errors and lead to rework and other problems.
[0068] In view of this, the embodiment of the present application provides a method for texture mapping unfolding of a voxel model. By determining the texture mapping coordinates of the texture mapping patches corresponding to the target quadrilateral faces that make up the outer surface of the voxel model in the unfolded texture mapping, and then according to the orientation of the target quadrilateral faces that make up the outer surface of the voxel model and the texture mapping coordinates of the texture mapping patches in the unfolded texture mapping, the texture mapping patches are spliced to obtain the texture mapping images corresponding to each outer surface of the voxel model. Finally, the texture mapping images are arranged in the pixel grid map according to the requirement that one texture mapping patch corresponds to one pixel of the pixel grid map to obtain the unfolded texture mapping of the voxel model; realizing automatic texture mapping unfolding of the voxel model, improving the efficiency and accuracy of texture mapping unfolding of the voxel model.
[0069] The texture mapping unfolding method of the voxel model provided by the embodiment of the present application can be applied to an electronic device. When it is necessary to split the texture mapping of the voxel model, the unfolded texture mapping of the voxel model can be automatically obtained. Among them, the electronic device can be hardware or software. When the electronic device is hardware, it can be implemented as a cluster composed of multiple servers or terminal devices, or a single server or a single terminal device. When the electronic device is software, it can be installed in the above-listed hardware devices.
[0070] Referring to Figure 1 , a flowchart of the steps of a texture mapping unfolding method of a voxel model provided by an embodiment of the present application is shown. In the embodiment of the present application, the method may include the following steps:
[0071] Step 101, obtain the target quadrilateral faces included in the outer surface of the voxel model to be processed;
[0072] Step 102, determine the texture mapping coordinates of the texture mapping face block corresponding to the target quadrilateral face in the unfolded texture mapping according to the three-dimensional coordinates of the target quadrilateral face in the voxel model;
[0073] Step 103, based on the texture mapping coordinates of the texture mapping face block in the unfolded texture mapping and the orientation of the target quadrilateral face on the voxel model, splice the texture mapping face blocks corresponding to the target quadrilateral faces with the same orientation into the texture mapping images respectively corresponding to the outer surface of the voxel model;
[0074] Step 104, arrange the texture mapping images into a pixel grid map to obtain the unfolded texture mapping of the voxel model, where each texture mapping face block in the texture mapping image corresponds to a pixel in the pixel grid map.
[0075] In an embodiment of the present application, by obtaining target quadrilateral faces included in the outer surface of a voxel model to be processed, according to the three-dimensional coordinates of the target quadrilateral faces in the voxel model, determining texture mapping coordinates of texture mapping patches corresponding to the target quadrilateral faces in an unfolded texture mapping, combining the orientations of the target quadrilateral faces on the voxel model, splicing texture mapping patches corresponding to the target quadrilateral faces with the same orientation into texture mapping images respectively corresponding to the outer surface of the voxel model, and finally arranging the texture mapping images into a pixel grid map in a manner that each texture mapping patch corresponds to one pixel in the pixel grid map corresponding to the texture mapping patch, an unfolded texture mapping of the voxel model is obtained; it can realize automatic generation of the unfolded texture mapping of the voxel model. At the same time, since in the process of generating the unfolded texture mapping of the voxel model in the embodiment of the present application, first, texture mapping patches corresponding to the target quadrilateral faces for forming the outer surface of the voxel model are obtained, and then texture mapping images are obtained through splicing. Therefore, it can also ensure the consistency of the texture mapping patches in the texture mapping images, solving the problems in the prior art that the texture mapping patches obtained by manual segmentation are inconsistent, and the unfolded texture mapping is inaccurate and inefficient by manually placing the texture mapping patches. The embodiment of the present application improves the efficiency and accuracy of generating the unfolded texture mapping.
[0076] Next, the method for unfolding the texture mapping of the voxel model in this exemplary embodiment will be further described.
[0077] In step 101, obtain target quadrilateral faces included in the outer surface of the voxel model to be processed.
[0078] In this embodiment, the voxel model to be processed refers to the voxel model for which the texture mapping needs to be split. The voxel model to be processed can be one or multiple. When there are multiple voxel models to be processed, the same subsequent processing procedures are respectively executed on each voxel model to obtain the unfolded texture mapping corresponding to each voxel model. It should be noted that multiple voxel models can be processed simultaneously in parallel or sequentially in series. The embodiment of the present application does not limit this.
[0079] The voxel model is composed of cubes, and each cube has six quadrilateral faces. The outer surface of the voxel model includes multiple planes. Therefore, each plane of the voxel model contains at least one quadrilateral face. As Figure 2 shown is a voxel model to be processed in an embodiment of the present application. The outer surface of the voxel model includes multiple planes, and each plane is composed of at least one quadrilateral face. For ease of understanding, one of the planes in the Figure 2 shown voxel model is identified, and one of the quadrilateral faces in the identified plane is identified. In the embodiment of the present application, the quadrilateral faces used to form the outer surface of the voxel model are defined as target quadrilateral faces to distinguish them from the quadrilateral faces inside the voxel model in the cube.
[0080] Exemplarily, when a relevant application program is executed on a processor of an electronic device, a graphical user interface can be rendered on the display screen of the electronic device, and one or more voxel models can be displayed in the graphical user interface; in response to a user's selection operation on the voxel model displayed in the graphical user interface, the voxel model selected by the selection operation is determined as the voxel model to be processed. If multiple cubes in the voxel model to be processed have been merged when forming the voxel model, that is, the four-sided faces that coincide between the multiple cubes forming the voxel model have been removed, and only the four-sided faces of the outer surface of the voxel model are retained, then the target four-sided faces of the voxel model to be processed can be directly obtained.
[0081] If multiple cubes in the voxel model to be processed have not been merged when forming the voxel model, that is, the six faces of each cube forming the voxel model are retained, then in an alternative embodiment of the present application, the process of obtaining the voxel model to be processed includes:
[0082] Determine the four-sided faces that do not coincide with the four-sided faces of other cubes among the four-sided faces of the cube as the target four-sided faces forming the outer surface of the voxel model.
[0083] In this embodiment, to obtain the voxel model to be processed, all the cubes forming the voxel model can be obtained. For each four-sided face of each cube, it can be determined whether the four-sided face coincides with the four-sided faces of other cubes. If it coincides, it means that the four-sided face is inside the voxel model; if it does not coincide, it means that the four-sided face is outside the voxel model. When the judgment result is non-coincidence, determine that the four-sided face is one of the target four-sided faces forming the outer surface of the voxel model, and obtain the target four-sided face. In the above manner, the four-sided faces that do not coincide with the four-sided faces of other cubes among the four-sided faces of each cube can be determined as the target four-sided faces forming the outer surface of the voxel model.
[0084] In an alternative embodiment of the present application, the voxel model is composed of multiple cubes, and each cube has six four-sided faces. The process of obtaining the voxel model to be processed includes:
[0085] Remove the four-sided faces that coincide between the multiple cubes to obtain the target four-sided faces forming the outer surface of the voxel model.
[0086] In this embodiment, all the cubes forming the voxel model can be obtained. Each cube has six four-sided faces. According to the position of the cube in the voxel model, the position information of each four-sided face of each cube can be determined. Then, according to the position information of each four-sided face, the four-sided faces with the same position information are determined as the coincident four-sided faces; remove the coincident four-sided faces, and the remaining four-sided faces are the target four-sided faces forming the outer surface of the voxel model.
[0087] In step 102, according to the three-dimensional coordinates of the target quadrilateral face in the voxel model, the texture mapping coordinates of the texture mapping patch corresponding to the target quadrilateral face in the unfolded texture mapping are determined.
[0088] In this embodiment, after obtaining the target quadrilateral face of the voxel model, combining the three-dimensional coordinates of the target quadrilateral face in the voxel model, the texture mapping coordinates of the texture mapping patch corresponding to the target quadrilateral face in the unfolded texture mapping can be determined. The graph corresponding to the texture mapping coordinates is the texture mapping patch, that is, a texture mapping patch corresponding to each target quadrilateral face is generated.
[0089] Exemplarily, it can be implemented based on maxscript (the built-in scripting language of 3ds Max) to generate the texture mapping patch corresponding to the target quadrilateral face. To implement the generation of the texture mapping patch corresponding to the target quadrilateral face based on maxscript, it is necessary to check whether the texture mapping channel is enabled before generating the texture mapping patch corresponding to the target quadrilateral face. When it is detected that the texture mapping channel is not enabled, the texture mapping channel is automatically enabled, where the texture mapping channel can be used to adjust or store information related to the model texture mapping.
[0090] As Figure 3 shown, Figure 3 are Figure 2 multiple texture mapping patches obtained after texture mapping unfolding of the target quadrilateral face of the voxel model shown. It should be noted that since the voxel model is composed of multiple cubes, there are 6 orientations of the face normals of the voxel model, and there are three pairs of face normals with opposite orientations. The texture mapping patches corresponding to the target quadrilateral faces with opposite face normal orientations may overlap.
[0091] It should be noted that Figure 3 the schematic diagram of the texture mapping patch corresponding to the target quadrilateral face of the voxel model shown can be displayed in the graphical user interface or may not be displayed in the graphical user interface. Generally, in the application mode of generating the unfolded texture mapping of the voxel model with one key, the user only needs to select the voxel model to be processed and trigger the texture mapping unfolding request for generating the unfolded texture mapping corresponding to the voxel model, and then the unfolded texture mapping corresponding to the voxel model can be directly returned to the user. Therefore, Figure 3 the schematic Figure 1 shown is generally not displayed in the graphical user interface. In the application mode of generating the unfolded texture mapping of the voxel model step by step, that is, during the process of generating the unfolded texture mapping of the voxel model, the user needs to trigger corresponding requests multiple times to execute a corresponding processing step based on one trigger request. Therefore, Figure 3 the schematic diagram shown can be displayed in the graphical user interface.
[0092] In an alternative embodiment of the present application, the process of determining the texture mapping coordinates of the texture mapping patch corresponding to the target quadrilateral face in the unfolded texture mapping according to the three-dimensional coordinates of the target quadrilateral face in the voxel model may include:
[0093] Obtain the three-dimensional coordinates of the geometric vertices of the target quadrilateral face;
[0094] Determine the texture mapping coordinates of the texture mapping patch corresponding to the target quadrilateral face in the unfolded texture mapping according to the three-dimensional coordinates of the geometric vertices.
[0095] In this embodiment, the texture mapping coordinates of the positions corresponding to the geometric vertices in the corresponding texture mapping patch can be determined by obtaining the three-dimensional coordinates of the geometric vertices of the target quadrilateral face, and then the texture mapping coordinates of the texture mapping patch can be determined. The texture mapping coordinates of the texture mapping patch include the texture mapping coordinates of each point constituting the texture mapping patch, and the texture mapping coordinates represent the identifier of the texture mapping patch in the unfolded texture mapping. Preferably, the target quadrilateral face can be a regular square, thereby improving the efficiency of obtaining the three-dimensional coordinates of the geometric vertices of the target quadrilateral face. Exemplarily, the target quadrilateral face can also be an irregular quadrilateral.
[0096] Exemplarily, a spatial rectangular coordinate system of the voxel model can be established to determine the three-dimensional coordinates of the four geometric vertices of each target quadrilateral face in the spatial rectangular coordinate system. By performing texture mapping coordinate conversion on the three-dimensional coordinates, the vertex texture mapping coordinates corresponding to the four vertices of the target quadrilateral face can be obtained, and then the texture mapping patch corresponding to the target quadrilateral face can be determined. According to the position information of the texture mapping patch in the texture mapping coordinates, the texture mapping coordinates of the texture mapping patch can be determined.
[0097] In this embodiment, the texture mapping coordinates of the texture mapping patch are determined by the three-dimensional coordinates of the geometric vertices of the target quadrilateral face, which can reduce the calculation amount and improve the generation efficiency of the texture mapping patch.
[0098] In another alternative embodiment of the present application, determining the texture mapping coordinates of the texture mapping patch corresponding to the target quadrilateral face in the unfolded texture mapping according to the three-dimensional coordinates of the geometric vertices includes:
[0099] Convert the three-dimensional coordinates of the geometric vertices into floating-point coordinates, and determine the texture mapping coordinates of the texture mapping patch corresponding to the target quadrilateral face in the unfolded texture mapping based on the floating-point coordinates.
[0100] Based on the above method of determining the texture mapping coordinates of the texture mapping patches according to the three-dimensional coordinates of the geometric vertices of the target quadrilateral surface, during the process of determining the texture mapping coordinates of the texture mapping patches, the three-dimensional coordinates of the geometric vertices of the target quadrilateral surface are first converted into corresponding floating-point coordinates, and then the texture mapping patches corresponding to the target quadrilateral surface and the texture mapping coordinates of the texture mapping patches are determined based on the floating-point coordinates. Preferably, the three-dimensional coordinates of the geometric vertices of the target quadrilateral surface are converted into floating-point coordinates from 0 to 1. Using the floating-point coordinates from 0 to 1 can make the corresponding program code smoothly transition in different pixel backgrounds, thereby improving compatibility.
[0101] Further, in some alternative embodiments of the present application, before determining the texture mapping coordinates of the texture mapping patches corresponding to the target quadrilateral surface in the unfolded texture mapping according to the three-dimensional coordinates of the geometric vertices, it may further include:
[0102] Sort the target quadrilateral surfaces according to their positional relationships in the voxel model, and determine the numbers of the corresponding texture mapping patches based on the numbers of the target quadrilateral surfaces;
[0103] The method of determining the texture mapping coordinates of the texture mapping patches corresponding to the target quadrilateral surface in the unfolded texture mapping according to the three-dimensional coordinates of the geometric vertices may include:
[0104] Sequentially determine the texture mapping coordinates of the corresponding texture mapping patches in the unfolded texture mapping according to the three-dimensional coordinates of the geometric vertices of the target quadrilateral surfaces in the order of their numbers.
[0105] Before determining the texture mapping coordinates of the texture mapping patches according to the three-dimensional coordinates of the geometric vertices of the target quadrilateral surface, the present embodiment first sorts the target quadrilateral surfaces and the texture mapping patches, and determines the texture mapping coordinates of the texture mapping patches in the order of their numbers, which can reduce the difficulty of script writing and improve the operating efficiency of the system.
[0106] Step 103: Based on the texture mapping coordinates of the texture mapping patches in the unfolded texture mapping and the orientation of the target quadrilateral surface on the voxel model, splice the texture mapping patches corresponding to the target quadrilateral surfaces with the same orientation into the texture mapping images corresponding to the outer surfaces of the voxel model respectively.
[0107] According to the orientation of the target quadrilateral face on the voxel model, the orientation of the corresponding texture mapping patch can be determined. Among them, the orientation of the target quadrilateral face can be determined by the face normal of the target quadrilateral face. Specifically, in the embodiments of the present application, the voxel model is composed of multiple cubes, and each cube includes 6 quadrilateral faces, that is, the face normal of the target quadrilateral face is one of the 6 orientations, and the modulus length of the normal component value of the corresponding axis is 1. The orientation of the face normal of the target quadrilateral face can be used as the orientation of the corresponding texture mapping patch. The texture mapping patches with the same orientation are spliced according to the texture mapping coordinates of the texture mapping patches to obtain at least one texture mapping image. It can be understood that a texture mapping image includes at least one texture mapping patch, and the texture mapping image is used to represent the plane of the outer surface in the voxel pixels.
[0108] As Figure 4 shown, Figure 4 is a schematic diagram of the texture mapping patches shown in Figure 3 after splicing to obtain a texture mapping image. Among them, Figure 4 the thick line marked part is used to represent the dividing line between different texture mapping images, and the texture mapping patches inside the thick line frame are spliced to obtain a texture mapping image. It should be noted that Figure 4 only part of the dividing lines are marked. For the convenience of understanding, in Figure 4 the texture mapping images corresponding to the marked planes are marked. Figure 2
[0109] It should also be noted that Figure 4 the texture mapping image obtained after splicing shown in Figure 4 can be displayed in the graphical user interface or not. Generally, in the method of generating the unfolded texture mapping of the voxel model with one key, Figure 1 the schematic diagram shown is generally not displayed in the graphical user interface; in the method of generating the unfolded texture mapping of the voxel model step by step, Figure 4 the schematic diagram shown can be displayed in the graphical user interface.
[0110] In an optional embodiment of the present application, the process of splicing the texture mapping patches corresponding to the target quadrilateral faces with the same orientation into the texture mapping images respectively corresponding to the outer surfaces of the voxel model based on the texture mapping coordinates of the texture mapping patches in the unfolded texture mapping and the orientation of the target quadrilateral faces on the voxel model may include:
[0111] Sort the texture mapping patches according to the texture mapping coordinates of the texture mapping patches in the unfolded texture mapping to obtain the serial numbers of the texture mapping patches;
[0112] According to the orientation of the target quadrilateral faces on the voxel model, divide the texture map patches corresponding to the target quadrilateral faces with the same orientation into the same set;
[0113] For the texture map patches in each set, splice the texture map patches in the same set according to the serial numbers of the texture map patches to obtain a texture map image.
[0114] In this embodiment, splicing the texture map patches with the same orientation in combination with the serial numbers of the texture map patches can ensure the accuracy of the splicing result and is easy to implement, that is, it can reduce the difficulty of writing the corresponding script.
[0115] Among them, the process of sorting multiple texture map patches to obtain the serial numbers of the texture map patches can sort according to the positions of the target quadrilateral faces in the voxel model to determine the serial numbers of the corresponding texture map patches, or can sort the texture map patches according to the texture map coordinates of the texture map patches in the unfolded texture map to obtain the serial numbers of the texture map patches. These serial numbers are used to distinguish the texture map patches corresponding to different target quadrilateral faces of the same plane constituting the outer surface of the voxel model and to determine the order of the splicing process.
[0116] In this embodiment, according to the orientation of the target quadrilateral faces, the texture map patches corresponding to the target quadrilateral faces with the same orientation can be divided into the same set. For the texture map patches in each set, according to the serial numbers of the texture map patches and the texture map coordinates of the texture map patches, determine the overlapping texture map edges of any two texture map patches, and splice the overlapping texture map edges. When all the overlapping texture map edges are spliced, the obtained spliced image is the texture map image.
[0117] It should be noted that the order of the texture map patches will not affect the splicing result. Therefore, in the embodiments of the present application, the process of determining the order of the texture map patches is not limited.
[0118] Step 104, arrange the texture map image in a pixel grid map to obtain the unfolded texture map of the voxel model, where each texture map patch in the texture map image corresponds to a pixel in the pixel grid map.
[0119] In the embodiments of the present application, arranging multiple texture map images in a pixel grid map means that the multiple texture map images do not overlap in the pixel grid map. Each texture map patch in the texture map image corresponds to a pixel in the pixel grid map, that is, each texture map patch coincides with a corresponding pixel in the pixel grid map, completing the unfolding of the texture map of the voxel model. That is to say, the multiple texture map images arranged in the pixel grid map obtained in this step are the unfolded texture map of the voxel model.
[0120] In some alternative embodiments of the present application, before arranging the texture map image into the pixel grid map to obtain the unfolded texture map of the voxel model, the method may further include:
[0121] Determine a pixel grid map according to the number of texture map patches of the voxel model, and the number of pixels of the pixel grid map is not less than the number of texture map patches.
[0122] In this embodiment, a pixel grid map can be determined according to the number of texture patches of the voxel model. Among them, the number of pixels of the pixel grid map is not less than the number of texture map patches, and it is necessary to meet the requirement that the texture map image of the voxel model can be arranged into the pixel grid map with one texture map patch coinciding with one pixel, and at most one pixel corresponding to one texture map patch, so as to obtain the unfolded texture map of the voxel model.
[0123] In some alternative embodiments of the present application, arranging multiple texture map images into the pixel grid map may include:
[0124] Obtain a first pixel grid map;
[0125] When the number of pixels of the first pixel grid map is less than the number of texture map patches, obtain a second pixel grid map from the pixel grid map library, and arrange the texture map image into the second pixel grid map to obtain the unfolded texture map of the voxel model; the number of pixels of the second pixel grid map is not less than the number of texture map patches;
[0126] When the number of pixels of the first pixel grid map is not less than the number of texture map patches, arrange the texture map image into the first pixel grid map.
[0127] In this embodiment, multiple texture map images are arranged into a pixel grid map. A first pixel grid map can be obtained first. When the number of pixels in the first pixel grid map is less than the number of texture map blocks of the voxel model, it can be considered that the texture map image of the voxel model cannot be arranged into the first pixel grid map according to the requirements that one texture map block coincides with one pixel and one pixel corresponds to at most one texture map block. At this time, a second pixel grid map is selected from the pixel grid map library. The number of pixels in the second pixel grid map is not less than the number of texture map blocks. The second pixel grid map needs to meet the requirements that the texture map image of the voxel model can be arranged into the second pixel grid map according to the requirements that one texture map block coincides with one pixel and one pixel corresponds to at most one texture map block, thereby obtaining the expanded texture map of the voxel model. When the number of pixels in the first pixel grid map is not less than the number of texture map blocks of the voxel model, that is, the texture map image of the voxel model can be arranged in the first pixel grid map according to the requirements that one texture map block coincides with one pixel and one pixel corresponds to at most one texture map block, the texture map image can be directly arranged in the first pixel grid map to obtain the expanded texture map of the voxel model; thereby achieving the effect of not requiring manual evaluation and manual change of the pixel grid map.
[0128] Among them, the first pixel grid map may refer to the pixel grid map currently used for arranging the texture map image. In one example, the pixel grid map library can sort the stored pixel grid maps in order from small to large according to the size of the pixel grid map. When the current pixel grid map cannot make the texture map image of the voxel model coincide with one texture map surface block and one pixel, and one pixel corresponds to at most one texture map surface block. When the current pixel grid map cannot be arranged according to the requirement of arranging, the current pixel grid map is updated to the pixel grid map of the next sorting order adjacent to it according to the sorting order of the current pixel grid map. Of course, the pixel grid maps in the pixel grid map library can also be sorted in order from large to small. When the current pixel grid map cannot be arranged, the current pixel grid map is updated to the pixel grid map of the previous sorting order adjacent to it according to the sorting order of the current pixel grid map, and the step of arranging the texture map image into the current pixel grid map is continued. The size of the current pixel grid map determined for the first time can be set by the user or by the system default.
[0129] Exemplarily, a setting window for the size of the pixel grid map can be displayed in the graphical user interface. In response to a setting operation for the size of the pixel grid map, the size corresponding to the setting operation is determined as the current pixel grid map size, and the process of arranging multiple texture mapping images into the current pixel grid map is executed. When it cannot be arranged, that is, when the current pixel grid map cannot make the texture mapping images of the voxel model arranged according to the requirement that one texture mapping patch coincides with one pixel and one pixel corresponds to at most one texture mapping patch, then from the pixel grid map library, a pixel grid map one size larger than the current pixel grid map is selected, and the selected pixel grid map is determined as the current pixel grid map, and the process of arranging multiple texture mapping images into the current pixel grid map is continued. Optionally, when the setting window for the pixel grid map size does not receive relevant operations from the user within a specified time, the pixel grid map with the system default settings can be adopted. The pixel grid map with the system default settings can be the pixel grid map with the smallest size in the pixel grid map library; it can also be the pixel grid map customized by the user last time. For example, if the size of the pixel grid map customized by the user last time is 128 * 128 pixels, then when the user performs the trigger operation for texture mapping expansion of the voxel model again, at this time, the size of the current pixel grid map is 128 * 128 pixels; it can also be the pixel grid map used last time. The pixel grid map used last time can be specifically understood as the pixel grid map finally used when performing texture mapping expansion on the previous voxel model. It is also possible to calculate the total number of texture mapping patches included in the multiple texture mapping images to be arranged, determine the set of pixel grid maps in the pixel grid map library where the number of pixels is more than the total number of texture mapping patches, and select the pixel grid map with the smallest size from this set of pixel grid maps as the pixel grid map with the system default settings.
[0130] Exemplarily, the setting window for the size of the pixel grid map can also not be displayed, and the pixel grid map with the system default settings can be directly adopted. The pixel grid map with the system default settings can be the pixel grid map with the smallest size or the largest size in the pixel grid map library; it can also be the pixel grid map used last time; it is also possible to calculate the total number of texture mapping patches included in the multiple texture mapping images to be arranged, that is, according to the number of texture mapping patches of the voxel model, obtain from the pixel grid map library the pixel grid map whose number of pixels is more than the total number of texture mapping patches as the pixel grid map with the system default settings. Or, according to the number of texture mapping patches of the voxel model, obtain from the pixel grid map library the set of pixel grid maps whose number of pixels is more than the number of texture mapping patches, and select the pixel grid map with the smallest size from this set of pixel grid maps as the pixel grid map with the system default settings.
[0131] Further, in order to prevent color bleeding from occurring in the unfolded texture map obtained by unwrapping the texture map during subsequent texture mapping production, in an optional embodiment of the present application, the process of arranging the texture map image into the pixel grid map to obtain the unfolded texture map of the voxel model includes:
[0132] Arrange the texture map image into the pixel grid map at a specified interval to obtain the unfolded texture map of the voxel model.
[0133] Among them, the specified interval can be set by the user customarily or set by the system by default. Exemplarily, a setting window for the specified interval can be displayed in the graphical user interface. In response to the user's setting operation for the specified interval, the pixels corresponding to the setting operation are determined as the specified interval, so as to arrange multiple texture map images into the pixel grid map at the specified interval to obtain the unfolded texture map of the voxel model. Exemplarily, when the setting window for the specified interval does not receive the user's relevant operation within the preset display time, the interval set by the system by default can be used as the specified interval; among them, the interval set by the system by default can be a fixed value. For example, the interval set by the system by default can be 1 pixel, 3 pixels, 4 pixels, etc.; it can also be a dynamic value, and this dynamic value can be the specified interval used last time, and the specified interval used last time can be the specified interval customarily set by the user last time.
[0134] Exemplarily, the setting window for the specified interval can also not be displayed, and the specified interval set by the system by default is directly adopted. The interval set by the system by default can be a fixed value; it can also be a dynamic value, and this dynamic value can be the specified interval used last time, and the specified interval used last time can be the specified interval customarily set by the user last time. As Figure 5 shown, Figure 5 For Figure 2 the unfolded texture map corresponding to the voxel model shown, it should be noted that Figure 5 the pixel grid in the pixel grid map is not shown; Figure 5 the texture map images marked in Figure 2 are the texture map images corresponding to the planes marked in
[0135] In an embodiment of the present application, by obtaining a target quadrilateral face included in the outer surface of a voxel model to be processed, determining texture mapping coordinates of a texture mapping patch corresponding to the target quadrilateral face in an unfolded texture mapping according to three-dimensional coordinates of the target quadrilateral face in the voxel model, combining the orientation of the target quadrilateral face on the voxel model, splicing texture mapping patches corresponding to target quadrilateral faces with the same orientation into texture mapping images respectively corresponding to the outer surface of the voxel model, and finally arranging the texture mapping images in a pixel grid diagram in a manner that each texture mapping patch corresponds to one pixel in the pixel grid diagram, an unfolded texture mapping of the voxel model is obtained. It can achieve automatic generation of the unfolded texture mapping of the voxel model. At the same time, since in the process of generating the unfolded texture mapping of the voxel model in this embodiment of the present application, first, texture mapping patches corresponding to target quadrilateral faces for forming the outer surface of the voxel model are obtained, and then texture mapping images are obtained through splicing. Therefore, it can also ensure the consistency of texture mapping patches in the texture mapping images, solving the problems in the prior art that texture mapping patches obtained by manual segmentation are inconsistent, and arranging texture mapping patches manually to obtain an unfolded texture mapping, resulting in inaccurate and low-efficiency unfolded texture mapping. This embodiment of the present application improves the efficiency and accuracy of generating the unfolded texture mapping.
[0136] It should be noted that for method embodiments, for the sake of simple description, they are all expressed as a series of action combinations. However, those skilled in the art should know that the embodiments of the present application are not limited by the described action sequence, because according to the embodiments of the present application, certain steps can be performed in other sequences or simultaneously. Secondly, those skilled in the art should also know that the embodiments described in the specification are all preferred embodiments, and the actions involved are not necessarily essential for the embodiments of the present application.
[0137] Refer to Figure 6 , which shows a structural block diagram of an embodiment of a texture mapping unfolding device for a voxel model of the present application. Corresponding to the above-mentioned method embodiment of texture mapping unfolding for a voxel model, the texture mapping unfolding device for a voxel model may include the following modules:
[0138] A target quadrilateral face acquisition module 601, configured to acquire a target quadrilateral face included in the outer surface of a voxel model to be processed;
[0139] A texture mapping patch generation module 602, configured to determine texture mapping coordinates of a texture mapping patch corresponding to the target quadrilateral face in an unfolded texture mapping according to three-dimensional coordinates of the target quadrilateral face in the voxel model;
[0140] A texture mapping image generation module 603, configured to splice texture mapping patches corresponding to target quadrilateral faces with the same orientation into texture mapping images respectively corresponding to the outer surfaces of the voxel model based on the texture mapping coordinates of the texture mapping patches in the unfolded texture mapping and the orientation of the target quadrilateral faces on the voxel model;
[0141] An unfolded texture mapping generation module 604, configured to arrange the texture mapping images in a pixel grid map to obtain the unfolded texture mapping of the voxel model, wherein each texture mapping patch in the texture mapping image corresponds to a pixel in the pixel grid map.
[0142] In an alternative embodiment of the present application, the voxel model is composed of multiple cubes, and each cube has six quadrilateral faces. The target quadrilateral face acquisition module 601 is configured to determine, as the target quadrilateral faces constituting the outer surface of the voxel model, the quadrilateral faces among the quadrilateral faces of the cubes that do not coincide with the quadrilateral faces of other cubes; or configured to remove the coincident quadrilateral faces among the multiple cubes to obtain the target quadrilateral faces constituting the outer surface of the voxel model.
[0143] In an alternative embodiment of the present application, the texture mapping patch generation module 602 includes:
[0144] A first acquisition module, configured to acquire the three-dimensional coordinates of the geometric vertices of the target quadrilateral faces;
[0145] A texture mapping coordinate determination module, configured to determine the texture mapping coordinates of the texture mapping patches corresponding to the target quadrilateral faces in the unfolded texture mapping according to the three-dimensional coordinates of the geometric vertices.
[0146] In an alternative embodiment of the present application, the texture mapping coordinate determination module is configured to convert the three-dimensional coordinates of the geometric vertices into floating-point coordinates and determine the texture mapping coordinates of the texture mapping patches corresponding to the target quadrilateral faces in the unfolded texture mapping based on the floating-point coordinates.
[0147] In an alternative embodiment of the present application, the texture mapping image generation module 603 includes:
[0148] A sorting module, configured to sort the texture mapping patches according to the texture mapping coordinates of the texture mapping patches in the unfolded texture mapping to obtain the serial numbers of the texture mapping patches;
[0149] A classification module, configured to divide the texture mapping patches corresponding to the target quadrilateral faces with the same orientation into the same set according to the orientation of the target quadrilateral faces on the voxel model;
[0150] A splicing module, which is used to splice the texture map patches in each set according to the serial numbers of the texture map patches to obtain a texture map image.
[0151] In an optional embodiment of the present application, the device further includes:
[0152] A grid map determination module, which is used to determine a pixel grid map according to the number of texture map patches of the voxel model, and the number of pixels of the pixel grid map is not less than the number of texture map patches.
[0153] In an optional embodiment of the present application, the unfolded texture map generation module 604 includes:
[0154] A grid map acquisition module, which is used to acquire a first pixel grid map;
[0155] A first generation module, which is used to, when the number of pixels of the first pixel grid map is less than the number of texture map patches, acquire a second pixel grid map from a pixel grid map library and arrange the texture map image in the second pixel grid map to obtain the unfolded texture map of the voxel model; the number of pixels of the second pixel grid map is not less than the number of texture map patches;
[0156] A second generation module, which is used to, when the number of pixels of the first pixel grid map is not less than the number of texture map patches, arrange the texture map image in the first pixel grid map.
[0157] In an optional embodiment of the present application, the unfolded texture map generation module 604 is used to arrange the texture map image in the pixel grid map at a specified interval to obtain the unfolded texture map of the voxel model.
[0158] For the device embodiment, since it is basically similar to the method embodiment, the description is relatively simple. For the relevant parts, please refer to the partial description of the method embodiment.
[0159] The embodiment of the present application also discloses an electronic device, including a processor, a memory, and a computer program stored on the memory and capable of running on the processor. When the computer program is executed by the processor, the steps of the texture map unfolding method of the voxel model as described above are implemented.
[0160] The embodiment of the present application also discloses a computer-readable storage medium, on which a computer program is stored. When the computer program is executed by a processor, the steps of the texture map unfolding method of the voxel model as described above are implemented.
[0161] Each embodiment in this specification is described in a progressive manner. Each embodiment focuses on the differences from other embodiments. For the same or similar parts among the embodiments, reference can be made to each other.
[0162] Those skilled in the art should understand that the embodiments of the present application can be provided as a method, a device, or a computer program product. Therefore, the embodiments of the present application can take the form of a complete hardware embodiment, a complete software embodiment, or an embodiment combining software and hardware aspects. Moreover, the embodiments of the present application can take the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage, CD-ROM, optical storage, etc.) that contain computer-usable program code.
[0163] The embodiments of the present application are described with reference to the flowcharts and / or block diagrams of the method, terminal device (system), and computer program product according to the embodiments of the present application. It should be understood that each process and / or block in the flowchart and / or block diagram, as well as the combination of processes and / or blocks in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to the processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing terminal devices to generate a machine, such that the instructions executed by the processor of the computer or other programmable data processing terminal devices generate a device for implementing the functions specified in Figure 1 one process or multiple processes and / or blocks Figure 1 one block or multiple blocks.
[0164] These computer program instructions can also be stored in a computer-readable memory that can direct a computer or other programmable data processing terminal device to work in a specific manner, such that the instructions stored in the computer-readable memory generate a manufactured article including an instruction device that implements the functions specified in Figure 1 one process or multiple processes and / or blocks Figure 1 one block or multiple blocks.
[0165] These computer program instructions can also be loaded onto a computer or other programmable data processing terminal device, such that a series of operation steps are executed on the computer or other programmable terminal device to generate a computer-implemented process. Thus, the instructions executed on the computer or other programmable terminal device provide steps for implementing the functions specified in Figure 1 one process or multiple processes and / or blocks Figure 1 one block or multiple blocks.
[0166] Although the preferred embodiments of the embodiments of the present application have been described, those skilled in the art can make additional changes and modifications once they learn the basic creative concepts. Therefore, the appended claims are intended to be construed to include the preferred embodiments as well as all changes and modifications that fall within the scope of the embodiments of the present application.
[0167] Finally, it should also be noted that in this text, relational terms such as first and second are only used to distinguish one entity or operation from another entity or operation, and do not necessarily require or imply any such actual relationship or order between these entities or operations. Moreover, the term "comprising", "including" or any other variant thereof is intended to cover non-exclusive inclusion, so that a process, method, article or terminal device comprising a series of elements not only includes those elements, but also includes other elements not expressly listed, or also includes elements inherent to such process, method, article or terminal device. Without further limitation, an element defined by the statement "comprising an..." does not exclude the presence of additional identical elements in the process, method, article or terminal device comprising the element.
[0168] The above has introduced in detail a method and apparatus for unwrapping texture mapping of a voxel model, an electronic device and a storage medium provided by the present application. Specific examples are used in this text to elaborate on the principle and implementation manner of the present application. The description of the above embodiments is only used to help understand the method and its core idea of the present application; at the same time, for those of ordinary skill in the art, according to the idea of the present application, there will be changes in the specific implementation manner and application scope. In summary, the content of this specification should not be construed as a limitation to the present application.
Claims
1. A method for unwrapping texture mapping of a voxel model, characterized in that, The method includes: Obtaining a target quadrilateral face included in the outer surface of the voxel model to be processed; Determining texture mapping coordinates of a texture mapping patch corresponding to the target quadrilateral face in the unfolded texture mapping according to three-dimensional coordinates of the target quadrilateral face in the voxel model; Based on the texture mapping coordinates of the texture mapping patch in the unfolded texture mapping and the orientation of the target quadrilateral face on the voxel model, splicing texture mapping patches corresponding to target quadrilateral faces with the same orientation into texture mapping images respectively corresponding to the outer surface of the voxel model; Arranging the texture mapping images in a pixel grid map to obtain the unfolded texture mapping of the voxel model, where each texture mapping patch in the texture mapping image corresponds to a pixel in the pixel grid map; Wherein, the voxel model is composed of multiple cubes, and each cube has six quadrilateral faces. The obtaining of the target quadrilateral face included in the outer surface of the voxel model to be processed includes: Determining a quadrilateral face that does not coincide with a quadrilateral face of other cubes among the quadrilateral faces of the cube as the target quadrilateral face constituting the outer surface of the voxel model; Or, Removing the coincident quadrilateral faces between multiple cubes to obtain the target quadrilateral face constituting the outer surface of the voxel model.
2. The method according to claim 1, wherein The determining of the texture mapping coordinates of the texture mapping patch corresponding to the target quadrilateral face in the unfolded texture mapping according to the three-dimensional coordinates of the target quadrilateral face in the voxel model includes: Obtaining three-dimensional coordinates of geometric vertices of the target quadrilateral face; Determining the texture mapping coordinates of the texture mapping patch corresponding to the target quadrilateral face in the unfolded texture mapping according to the three-dimensional coordinates of the geometric vertices.
3. The method according to claim 2, wherein The determining of the texture mapping coordinates of the texture mapping patch corresponding to the target quadrilateral face in the unfolded texture mapping according to the three-dimensional coordinates of the geometric vertices includes: Converting the three-dimensional coordinates of the geometric vertices into floating-point coordinates, and determining the texture mapping coordinates of the texture mapping patch corresponding to the target quadrilateral face in the unfolded texture mapping based on the floating-point coordinates.
4. The method according to claim 3, characterized in that The splicing of texture mapping patches corresponding to target quadrilateral faces with the same orientation into texture mapping images respectively corresponding to the outer surface of the voxel model based on the texture mapping coordinates of the texture mapping patch in the unfolded texture mapping and the orientation of the target quadrilateral face on the voxel model includes: Sorting the texture mapping patches according to the texture mapping coordinates of the texture mapping patches in the unfolded texture mapping to obtain serial numbers of the texture mapping patches; Dividing texture mapping patches corresponding to target quadrilateral faces with the same orientation into the same set according to the orientation of the target quadrilateral face on the voxel model; For the texture mapping patches in each set, splicing the texture mapping patches in the same set according to the serial numbers of the texture mapping patches to obtain a texture mapping image.
5. The method according to claim 1, wherein The method further includes: Determining a pixel grid map according to the number of texture mapping patches of the voxel model, and the number of pixels in the pixel grid map is not less than the number of texture mapping patches.
6. The method according to claim 1, characterized in that, Arranging the texture map image into a pixel grid map to obtain the unfolded texture map of the voxel model includes: Obtaining a first pixel grid map; When the number of pixels in the first pixel grid map is less than the number of texture map patches, obtaining a second pixel grid map from a pixel grid map library, and arranging the texture map image into the second pixel grid map to obtain the unfolded texture map of the voxel model; the number of pixels in the second pixel grid map is not less than the number of texture map patches; When the number of pixels in the first pixel grid map is not less than the number of texture map patches, arranging the texture map image into the first pixel grid map.
7. The method according to any one of claims 1-6, characterized in that, Arranging the texture map image into a pixel grid map to obtain the unfolded texture map of the voxel model includes: Arranging the texture map image into the pixel grid map at a specified interval to obtain the unfolded texture map of the voxel model.
8. A texture mapping unfolding device for a voxel model, characterized in that, The apparatus includes: A target quadrilateral surface obtaining module, configured to obtain target quadrilateral surfaces included in the outer surface of a voxel model to be processed; A texture map patch generating module, configured to determine texture map coordinates of a texture map patch corresponding to the target quadrilateral surface in the unfolded texture map according to three-dimensional coordinates of the target quadrilateral surface in the voxel model; A texture map image generating module, configured to splice texture map patches corresponding to target quadrilateral surfaces with the same orientation into texture map images respectively corresponding to the outer surface of the voxel model based on the texture map coordinates of the texture map patches in the unfolded texture map and the orientation of the target quadrilateral surface on the voxel model; An unfolded texture map generating module, configured to arrange the texture map images into a pixel grid map to obtain the unfolded texture map of the voxel model, wherein each texture map patch in the texture map image corresponds to a pixel in the pixel grid map; Wherein, the voxel model is composed of multiple cubes, each cube has six quadrilateral surfaces, and the target quadrilateral surface obtaining module is configured to determine, as target quadrilateral surfaces constituting the outer surface of the voxel model, quadrilateral surfaces among the quadrilateral surfaces of the cube that do not coincide with quadrilateral surfaces of other cubes; or, configured to remove coincident quadrilateral surfaces between multiple cubes to obtain target quadrilateral surfaces constituting the outer surface of the voxel model.
9. An electronic device, characterized in that, Including a processor, a memory, and a computer program stored on the memory and capable of running on the processor, and when the computer program is executed by the processor, the steps of the method for texture map unfolding of the voxel model according to any one of claims 1 to 7 are implemented.
10. A computer-readable storage medium, characterized in that, A computer program is stored on the computer-readable storage medium, and when the computer program is executed by a processor, the steps of the method for texture map unfolding of the voxel model according to any one of claims 1 to 7 are implemented.
Citation Information
Patent Citations
Smoothing method and device for voxel model and electronic equipment
CN113643191A
Target model rendering method and device, equipment and storage medium
CN113947657A