An automatic mapping method for small texture aggregation in 3D models
Through the automatic mapping method of small texture aggregation, format conversion, texture repetitive expansion and edge-based texture merging algorithms, the problem of inefficient texture merging in three-dimensional modeling software is solved, efficient texture merging and automatic mapping are achieved, and model rendering efficiency is improved.
Patent Information
- Application Number
- CN202411804302.4
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-12-10
- Publication Date
- 2025-05-13
- Estimated Expiration
- 2044-12-10
AI Technical Summary
The existing three-dimensional modeling software is inefficient in texture merging and mapping, resulting in slowing down model rendering and traditional manual stitching textures.
A small texture aggregation automatic mapping method is adopted to achieve efficient merge and automatic mapping of textures through format conversion, texture repetitive expansion and texture merging algorithm based on edge method.
It improves the degree of matching of large texture boundaries after texture merging, reduces fragmented space inside texture merging, improves the utilization rate of aggregated texture files, saves memory resources, and significantly improves model rendering efficiency.
Smart Images

Figure CN119295635B_ABST
Abstract
Description
Technical Field
[0001] The present application relates to the technical field of three-dimensional modeling, and in particular to a small texture aggregation automatic mapping method for three-dimensional models. Background Art
[0002] In recent years, with the application of digital and intelligent technologies in life, the fields of 3D modeling design and 3D simulation have also developed rapidly, and the requirements for model rendering speed have become increasingly higher. The process of 3D modeling requires a lot of effort to do some repetitive work. To this end, it is particularly important to develop technologies that can save more manpower and improve model rendering efficiency. Traditional textures can only be manually mapped one by one in turn by texture files, or multiple small textures can be manually spliced into large textures according to rules through image processing tools such as PhotoShop and Gimp. The splicing process is cumbersome and time-consuming, which greatly reduces the efficiency of modeling. The Texture Compositor plug-in that comes with the existing Presagis Creator modeling software can only merge textures on the same plane. When facing models with complex structures, the merging efficiency is not significantly improved compared to the traditional manual method, and the expected effect cannot be achieved. Summary of the invention
[0003] The purpose of the present invention is to provide a small texture aggregation automatic mapping method for a three-dimensional model, which can effectively increase the rendering efficiency of the texture, efficiently and conveniently merge all the textures of the model and map the texture of the model, and can maximize the degree of boundary matching of large textures after texture merging, reduce the fragmentation space inside the texture merging, improve the utilization rate of the aggregated texture file, and save memory resources.
[0004] The technical solution adopted by the present invention is: a small texture aggregation automatic mapping method for a three-dimensional model, comprising the following steps:
[0005] S1: Convert the texture files of different formats in the 3D model into a unified format;
[0006] S2: Texture mapping saved according to each vertex on the 3D model uv The coordinate value determines whether the texture needs to be repeatedly expanded. If the texture mapping uv Coordinate value u The maximum value of the coordinates or v If the maximum value of the coordinate exceeds the interval [0,1], it is necessary to expand the texture on the geometric surface to which the vertex of the 3D model belongs to generate a new texture of the required size;
[0007] S3: using a texture merging algorithm based on the edge method to calculate the texture files of a unified format and after repeated expansion, to obtain the relative coordinates of each texture in the aggregated texture, and merging each texture one by one according to the relative coordinates to form an aggregated texture with neat arrangement and minimal internal fragment free space;
[0008] The specific steps of the texture merging algorithm based on the edge-fitting method are as follows: obtain the relative position coordinates of each small texture in the aggregated texture, wherein the coordinates are based on the lower left corner of the rectangular texture; and introduce the concept of free edges, where a free edge refers to an edge that can be adjacent to a certain edge of a small texture when merging; based on the free edge, the long edge of the small texture is used for edge-fitting, and the free edges are traversed from small to large to judge the priority of the free edges. The priority judgment rule is as follows: first judge the length of the free edge, and the larger the length difference, the lower the priority, and the same length has the highest priority; after determining the length of the free edge, the direction of the free edges with the same length is judged; for a horizontal free edge, if the free direction is upward, it represents other textures. Only the bottom edge can be used to adjoin the free edge, and the texture is kept on the upper side of the free edge; for the free edges in the horizontal direction, the priority of the free right edge is higher than the free left edge, and for the free edges in the vertical direction, the priority of the free top edge is higher than the free bottom edge; if the free edges have the same length and direction, the priority is determined according to the order of traversing the free edges; then the texture out-of-bounds judgment is performed to determine whether it exceeds the specified area of the aggregated texture after the edge merging, and the edge that is most suitable for adjoining the longest edge of the small texture is found. After the edge merging is completed, the coordinates of the lower left corner of the texture at this time are determined and saved. After completing the edge merging of a small texture, the free edges are sorted, and then the edge merging of the next texture is performed until all textures are completed.
[0009] S4: Based on the aggregated texture generated in step S3, texture mapping is performed on each vertex of the 3D model. uv The coordinates are converted through texture mapping of each vertex on the model geometry surface with the original small texture attached uv Coordinates, calculate the texture mapping of each vertex of the geometric surface of the model using aggregate texture mapping uv Coordinates, and use aggregate textures to replace the original small textures to achieve automatic mapping of the aggregate texture model, achieving the same rendering effect as the small texture mapping model.
[0010] Furthermore, the specific steps of step S1 are: uniformly converting texture files of different formats into PNG format files; wherein, for files in JPG format, parsing and RGB data extraction are performed; for files in RGB format or RGBA format, firstly analyzing the RGB information of the RGB file or RGBA file to obtain an RGB format hexadecimal file, and storing each channel data in blocks, and then extracting three bytes of data with the same relative position from each channel data block to form (R, G, B) to represent a pixel, until all pixels in the complete texture image are extracted to obtain the complete RGB information of the texture file, and finally extracting the color data of the RGB file or RGBA file, wherein, in order to make the color data format of the RGB file and the RGBA file the same and facilitate algorithm compatibility, for RGB image types without an Alpha channel, the Alpha data value is set to 255, and then the RGB data of each texture file is merged with the Alpha data to form new RGBA data of the texture image.
[0011] Furthermore, the specific steps of step S2 are:
[0012] S201: Use the depth traversal algorithm to query the texture information of the geometric surface with the texture and the texture mapping of each vertex of the geometric surface uv Coordinates, and save texture information and texture mapping of vertices on the geometric surface mapped with the texture uv The minimum and maximum values of the coordinates;
[0013] S202: Combine the saved texture information with texture mapping uv The minimum and maximum coordinates are calculated to calculate the texture mapping of the geometric surface vertices of the texture after expansion. uv Coordinates, the specific formula is:
[0014] ;
[0015] ;
[0016] in, u is the texture mapping coordinate of the vertex before transformation u coordinate, v is the texture mapping coordinate of the vertex before transformation v coordinate, minU Represents texture mapping uv Coordinates u The minimum value of the coordinates, minV Represents texture mapping uv Coordinates v The minimum value of the coordinates, maxU Represents texture mapping uv Coordinates u The maximum value of the coordinates,maxV Represents texture mapping uv Coordinates v The maximum value of the coordinates, new_u Texture mapping coordinates of the geometric surface vertices mapped with the dilated texture u coordinate, new_v Texture mapping coordinates of the geometric surface vertices mapped with the dilated texture v coordinate, Indicates rounding down. Indicates rounding up.
[0017] Furthermore, the specific steps of step S3 are:
[0018] S301: Create a white image as a canvas for texture merging;
[0019] S302: using a texture merging algorithm based on the edge-fitting method to obtain the relative position coordinates of each small texture in the aggregated texture, wherein the coordinates are based on the lower left corner of the rectangular texture;
[0020] S303: Determine the area of the small texture in the aggregated texture according to the texture relative position coordinates and the width and height of the texture obtained in step S302;
[0021] S304: writing the RGBA data of each small texture obtained in step S1 into the corresponding area of the aggregate texture one by one, generating an aggregate texture, and completing the texture merging operation.
[0022] Furthermore, the specific steps of step S4 are:
[0023] S401: deeply traverse each face and vertex of the 3D model. When a textured face is traversed, record the texture information of the face, then continue to traverse each vertex of the face and record the texture mapping of each vertex. uv coordinate;
[0024] S402: Exploitation uv Coordinate transformation formula, the mapping obtained in step S401 uv Coordinate conversion to relative to the aggregate texture map uv Coordinates, the specific formula is:
[0025] ;
[0026] ;
[0027] in, u Represents the texture mapping coordinates of the vertex before transformation u coordinate, v Represents the texture mapping coordinates of the vertex before transformation vcoordinate, x Indicates the size of the small texture in the aggregate texture x coordinate, y Indicates the size of the small texture in the aggregate texture y coordinate, width Indicates the width of the small texture, height in, u Represents the texture mapping coordinates of the vertex before transformation u coordinate, v Represents the texture mapping coordinates of the vertex before transformation v coordinate, x Indicates the size of the small texture in the aggregate texture x coordinate, y Indicates the size of the small texture in the aggregate texture y coordinate, width Indicates the width of the small texture, height Indicates the height of the small texture, U Represents the texture mapping coordinates of the transformed point u coordinate, V Represents the texture mapping coordinates of the transformed point v coordinate;
[0028] S403: importing the aggregated texture obtained in step S3 into the texture palette, obtaining texture index information of the aggregated texture, and writing the index information into the surface traversed in step S401;
[0029] S404: Combine the relative texture mapping based on the aggregate texture obtained in step S402 uv The coordinates and the texture index information of the aggregated texture obtained in step S403 complete the automatic remapping of the three-dimensional model of the aggregated texture.
[0030] The beneficial effects of the present invention are:
[0031] The texture merging algorithm technology based on the edge-fitting method of the present invention can maximize the degree of boundary matching of large textures after texture merging, reduce the fragmentation space inside the texture merging, improve the utilization rate of aggregated texture files, and save memory resources; in terms of speed, compared with the currently most used PS merging, the merging speed can be greatly improved, and the modeling efficiency can be improved; in terms of effect, the unified mapping after the texture merging has the same mapping effect as the original single texture one-to-one mapping; in terms of use, the present invention is simple to operate, and only needs to upload the flt model file to automatically complete the merging and mapping of textures; in terms of condition restrictions, compared with the Texture Compositor plug-in provided by the Presagis Creator modeling software, the present invention does not have the restriction of only merging the same plane. BRIEF DESCRIPTION OF THE DRAWINGS
[0032] In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings required for use in the embodiments will be briefly introduced below. Obviously, the drawings described below are only some embodiments of the present application. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.
[0033] Figure 1 is a flow chart of a method according to an embodiment of the present invention;
[0034] Figure 2 This is a schematic diagram of the existing small texture mapping method;
[0035] Figure 3 A schematic diagram of a polymerized texture mapping method used in an embodiment of the present invention;
[0036] Figure 4 This is a statistical graph of the number of texture aggregations and the time used in processing an embodiment of the present invention. DETAILED DESCRIPTION
[0037] In order to more clearly understand the above-mentioned purpose, features and advantages of the present invention, the present invention is further described in detail below in conjunction with the accompanying drawings and specific embodiments. In the following description, many specific details are set forth to facilitate a full understanding of the present invention, but the present invention can also be implemented in other ways different from those described herein, and therefore, the present invention is not limited to the limitations of the specific embodiments disclosed below.
[0038] like Figure 1 As shown, the embodiment of the present invention proposes a small texture aggregation automatic mapping method for a three-dimensional model, comprising the following steps:
[0039] S1: Convert the texture files of different formats in the three-dimensional model to a unified format. In the embodiment of the present invention, the format of the input file is a flt file, extract the texture files in the flt file, and convert the texture files of different formats to a unified PNG format file.
[0040] Among them, for files in JPG format, the JPEG library function is used to decompress and parse the extraction of RGB data. For files in RGB format or RGBA format, the RGB information of the RGB file or RGBA file is first analyzed to obtain the RGB format hexadecimal file, and the data of each channel is stored in blocks. According to the analysis of the .RGB format hexadecimal file, the RGB data of the texture image is from 0x00000200 to the end of the file. For example, for a 256*256 pixel texture pallet, the RGB data is 256*256*3 bytes, of which R data is stored from 0x00000200 to 0x000101f0, G data is stored from 0x00010200 to 0x00020200, and B data is stored in the same way. Secondly, three bytes of data with the same relative position are extracted from each channel data block to form (R, G, B) to represent a pixel, until all pixels in the complete texture image are extracted to obtain the complete RGB information of the texture file. Finally, the color data of the RGB file or RGBA file is extracted. In order to make the color data format of the RGB file and the RGBA file the same and facilitate algorithm compatibility, for RGB images without an Alpha channel, the Alpha data value is set to 255. Then, the RGB data of each texture file is merged with the Alpha data to form new RGBA data of the texture image.
[0041] S2: Texture mapping saved according to each vertex on the 3D model uv The coordinate value determines whether the texture needs to be repeatedly expanded. If the texture mapping uv Coordinate value u The maximum value of the coordinates or v If the maximum value of the coordinate exceeds the interval [0,1], it is necessary to expand the texture on the geometric surface to which the vertex of the 3D model belongs to generate a new texture of the required size. The specific steps are:
[0042] S201: Since the 3D model in flt format stores each element of the model in a tree structure, the embodiment of the present invention uses a depth traversal algorithm to query the texture information of the geometric surface with texture and the texture mapping of each vertex of the geometric surface. uv Coordinates, and save texture information and texture mapping of vertices on the geometric surface mapped with the texture uv The minimum and maximum values of the coordinates.
[0043] S202: Combine the saved texture information with texture mapping uv The minimum and maximum coordinates are calculated to calculate the texture mapping of the geometric surface vertices of the texture after expansion. uv Coordinates, the specific formula is:
[0044] ;
[0045] ;
[0046] in, u is the texture mapping coordinate of the vertex before transformation u coordinate, v is the texture mapping coordinate of the vertex before transformation v coordinate, minU Represents texture mapping uv Coordinates u The minimum value of the coordinates, minV Represents texture mapping uv Coordinates v The minimum value of the coordinates, maxU Represents texture mapping uv Coordinates u The maximum value of the coordinates, maxV Represents texture mapping uv Coordinates v The maximum value of the coordinates, new_u Texture mapping coordinates of the geometric face vertices mapped with the dilated texture u coordinate, new_v Texture mapping coordinates of the geometric face vertices mapped with the dilated texture v coordinate, Indicates rounding down. Indicates rounding up.
[0047] by Figure 2 As an example, the small texture shown in the figure has four vertices. uv The coordinates are (0.049759, 0.334675), (0.682539, 0.334675), (0.682539, 0.596414), and (0.049759, 0.596414), respectively. It is determined that the texture does not need to be expanded and no coordinate transformation is required.
[0048] S3: Calculate the texture files in a unified format and after repeated expansion using a texture merging algorithm based on the edge method to obtain the relative coordinates of each texture in the aggregated texture, and merge each texture one by one according to the relative coordinates to form an aggregated texture with neat arrangement and minimal internal fragment free space; the specific steps are:
[0049] S301: Create a 2048*2048 white image, that is, initialize the RGBA data of the image to R=255, G=255, B=255, A=255, as a canvas for texture merging.
[0050] S302: Utilize the texture merging algorithm based on the edge method to obtain the relative position coordinates of each small texture in the aggregated texture, where the coordinates are based on the lower left corner of the rectangular texture. Specifically, first arrange the single textures from large to small based on area. This step is to minimize the internal fragmentation space of the aggregated texture. Then the concept of free edges is introduced. Free edges refer to edges that can be adjacent to a certain edge of a small texture when merging, and the edges have free directions; if it is a horizontal edge, if the free direction is up, it means that other textures can only be adjacent to the free edge with the bottom edge, and the texture remains on the upper side of the free edge; save the free edges of the texture. The initial situation of the free edges is the four edges of a square of 2048*2048 pixels, and the free directions are all towards the inside of the square. According to the free edge, the long edge of the small texture is used for edge pasting, and the free edge is traversed from small to large to judge the priority of the free edge. The priority rule is: first determine the length of the free edge. The larger the length difference, the lower the priority. When the length is the same, the priority is the highest. After determining the length of the free edge, the direction of the free edge with the same length is judged. For the free edge in the horizontal direction, the priority of the right side is higher than the left side. For the free edge in the vertical direction, the priority of the upper side is higher than the lower side. If the length and direction of the free edge are the same, the priority is determined according to the order of traversing the free edges. Then, the texture cross-border judgment is performed to determine whether it exceeds the specified area of the aggregated texture after the edge merging, and find the edge that is most suitable for adjacent to the longest side of the small texture. After the edge pasting is completed, the coordinates of the lower left corner of the texture are determined and saved. After completing the edge pasting of a small texture, the free edges are sorted. The rectangular texture has four edges. After the texture is pasted, the free edges will also change accordingly. The edges that become non-free due to the edge pasting are eliminated, the edges that can be connected are merged, and the edges that need to be modified are modified to prepare for the next small texture pasting. After completion, follow the above process to bind the next texture until all textures are bound.
[0051] S303: Determine the area of the small texture in the aggregated texture according to the texture relative position coordinates and the width and height of the texture obtained in step S302.
[0052] S304: Write the RGBA data of each small texture obtained in step S1 into the corresponding area of the aggregated texture one by one to generate an aggregated texture, and complete the texture merging operation. The coordinate information of the texture in the aggregated texture obtained after calculation by the texture merging algorithm based on the edge method in the example of the present invention is shown in Table 1.
[0053] Table 1 Coordinates of textures when merging in the present invention
[0054]
[0055] S4: Based on the aggregated texture generated in step S3, texture mapping is performed on each vertex of the 3D model. uv The coordinates are converted through texture mapping of each vertex on the model geometry surface with the original small texture attached uv Coordinates, calculate the texture mapping of each vertex of the geometric surface of the model using aggregate texture mapping uv Coordinates, and use aggregate textures to replace the original small textures to achieve automatic mapping of the aggregate texture model, achieving the same rendering effect as the small texture mapping model. The specific steps are:
[0056] S401: deeply traverse each face and vertex of the 3D model. When a textured face is traversed, record the texture information of the face, then continue to traverse each vertex of the face and record the texture mapping of each vertex. uv coordinate;
[0057] S402: Exploitation uv Coordinate transformation formula, the mapping obtained in step S401 uv Coordinate conversion to relative to the aggregate texture map uv Coordinates, the specific formula is:
[0058] ;
[0059] ;
[0060] in, u Represents the texture mapping coordinates of the vertex before transformation u coordinate, v Represents the texture mapping coordinates of the vertex before transformation v coordinate, x Indicates the size of the small texture in the aggregate texture x coordinate, y Indicates the size of the small texture in the aggregate texture y coordinate, width Indicates the width of the small texture, height Indicates the height of the small texture, U Represents the texture mapping coordinates of the transformed point u coordinate, V Represents the texture mapping coordinates of the transformed point v coordinate;
[0061] S403: importing the aggregated texture obtained in step S3 into the texture palette, obtaining texture index information of the aggregated texture, and writing the index information into the surface traversed in step S401;
[0062] S404: Combine the relative texture mapping based on the aggregate texture obtained in step S402 uvThe coordinates and the texture index information of the aggregated texture obtained in step S403 complete the automatic remapping of the three-dimensional model of the aggregated texture.
[0063] In the present invention, Figure 2 The texture shown is converted to the relative coordinates based on the aggregate texture map. uv The coordinates are as follows: (0.049759, 0.334675) is converted to (0.512440, 0.083669), (0.682539, 0.334675) is converted to (0.670635, 0.083669), (0.682539, 0.596414) is converted to (0670635, 0.149103), (0.049759, 0.596414) is converted to (0.512440, 0.149103); the texture index saved on the three-dimensional model surface is changed to the aggregated texture index, and the aggregated texture index in the example of the present invention is 256.
[0064] Figure 2 Schematic diagram of the existing small texture mapping method. The existing mapping method is to use each small texture as a file, which means that 15 files in Table 1 need to be read and written when rendering a three-dimensional model. The aggregate texture mapping method used in the example of the present invention is as follows Figure 3 As shown, the aggregated texture generated by the texture merging algorithm based on the edge method can minimize the internal fragment free space generated during the merging. It can be seen that the internal fragment space in this embodiment is 0. Compared with the merging function of the Texture Compositor plug-in that comes with the existing Presagis Creator modeling software, the embodiment of the present invention can save the space occupied by the merging of all textures in the model. And the method described in the embodiment of the present invention can merge all the textures in the model, while the Texture Compositor plug-in can only merge textures on the same horizontal plane. In addition, compared with the existing small texture mapping method, the method described in the embodiment of the present invention only needs to read and write one file when rendering the three-dimensional model, that is, Figure 3 As shown in the aggregate texture, each small rectangular grid in the aggregate texture is a part of the aggregate texture and has the same function as a single small texture. The mapping method based on the aggregate texture is as follows Figure 3 As shown by the dotted line, after the mapping of the aggregate texture, when rendering the model, only one aggregate texture file needs to be read and written, which greatly improves the rendering efficiency compared to the existing small texture mapping method that requires reading and writing 15 files.
[0065] The above description is only a preferred embodiment of the present invention and is not intended to limit the present invention. For those skilled in the art, the present invention may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present invention shall be included in the protection scope of the present invention.
Claims
1. A small texture aggregation automatic mapping method for a three-dimensional model, characterized in that: The steps include: S1: Convert the texture files of different formats in the 3D model into a unified format; S2: Texture mapping saved according to each vertex on the 3D model uv The coordinate value determines whether the texture needs to be repeatedly expanded. If the texture mapping uv Coordinate value u The maximum value of the coordinates or v If the maximum value of the coordinate exceeds the interval [0,1], it is necessary to expand the texture on the geometric surface to which the vertex of the 3D model belongs to generate a new texture of the required size; S3: using a texture merging algorithm based on the edge method to calculate the texture files of a unified format and after repeated expansion, to obtain the relative coordinates of each texture in the aggregated texture, and merging each texture one by one according to the relative coordinates to form an aggregated texture with neat arrangement and minimal internal fragment free space; The specific steps of the texture merging algorithm based on the edge-fitting method are as follows: obtain the relative position coordinates of each small texture in the aggregated texture, wherein the coordinates are based on the lower left corner of the rectangular texture; and introduce the concept of free edges, where a free edge refers to an edge that can be adjacent to a certain edge of a small texture when merging; based on the free edge, the long edge of the small texture is used for edge-fitting, and the free edges are traversed from small to large to judge the priority of the free edges. The priority judgment rule is as follows: first judge the length of the free edge, and the larger the length difference, the lower the priority, and the same length has the highest priority; after determining the length of the free edge, the direction of the free edges with the same length is judged; for a horizontal free edge, if the free direction is upward, it represents other textures. Only the bottom edge can be used to adjoin the free edge, and the texture is kept on the upper side of the free edge; for the free edges in the horizontal direction, the priority of the free right edge is higher than the free left edge, and for the free edges in the vertical direction, the priority of the free top edge is higher than the free bottom edge; if the free edges have the same length and direction, the priority is determined according to the order of traversing the free edges; then the texture out-of-bounds judgment is performed to determine whether it exceeds the specified area of the aggregated texture after the edge merging, and the edge that is most suitable for adjoining the longest edge of the small texture is found. After the edge merging is completed, the coordinates of the lower left corner of the texture at this time are determined and saved. After completing the edge merging of a small texture, the free edges are sorted, and then the edge merging of the next texture is performed until all textures are completed. S4: Based on the aggregated texture generated in step S3, texture mapping is performed on each vertex of the 3D model. uv The coordinates are converted through texture mapping of each vertex on the model geometry surface with the original small texture attached uv Coordinates, calculate the texture mapping of each vertex of the geometric surface of the model using aggregate texture mapping uv Coordinates, and use aggregate textures to replace the original small textures to achieve automatic mapping of the aggregate texture model, achieving the same rendering effect as the small texture mapping model.
2. The small texture aggregation automatic mapping method for a three-dimensional model according to claim 1, characterized in that: The specific steps of step S1 are: uniformly converting texture files of different formats into PNG format files; wherein, for JPG format files, parsing and RGB data extraction are performed; for RGB format or RGBA format files, firstly analyzing the RGB information of the RGB file or RGBA file to obtain an RGB format hexadecimal file, and storing each channel data in blocks, and then extracting three bytes of data with the same relative position from each channel data block to form (R, G, B) to represent a pixel, until all pixels in the complete texture image are extracted to obtain the complete RGB information of the texture file, and finally extracting the color data of the RGB file or RGBA file, wherein, in order to make the color data format of the RGB file and the RGBA file the same and facilitate algorithm compatibility, for RGB image types without Alpha channels, the Alpha data value is set to 255, and then the RGB data of each texture file is merged with the Alpha data to form new RGBA data of the texture image.
3. The small texture aggregation automatic mapping method for three-dimensional models according to claim 2 is characterized in that: The specific steps of step S2 are: S201: Use the depth traversal algorithm to query the texture information of the geometric surface with the texture and the texture mapping of each vertex of the geometric surface uv Coordinates, and save texture information and texture mapping of vertices on the geometric surface mapped with the texture uv Minimum and maximum values of coordinates; S202: Combine the saved texture information with texture mapping uv The minimum and maximum coordinates are calculated to calculate the texture mapping of the geometric surface vertices of the texture after expansion. uv Coordinates, the specific formula is: ; ; in, u is the texture mapping coordinate of the vertex before transformation u coordinate, v is the texture mapping coordinate of the vertex before transformation v coordinate, U Represents texture mapping uv Coordinates u The minimum value of the coordinates, minV Represents texture mapping uv Coordinates v The minimum value of the coordinates, maxU Represents texture mapping uv Coordinates u The maximum value of the coordinates, maxV Represents texture mapping uv Coordinates v The maximum value of the coordinates, new_u Texture mapping coordinates of the geometric surface vertices mapped with the dilated texture u coordinate, new_v Texture mapping coordinates of the geometric surface vertices mapped with the dilated texture v coordinate, Indicates rounding down. Indicates rounding up.
4. The small texture aggregation automatic mapping method for three-dimensional models according to claim 3 is characterized in that: The specific steps of step S3 are: S301: Create a white image as a canvas for texture merging; S302: using a texture merging algorithm based on the edge-fitting method to obtain the relative position coordinates of each small texture in the aggregated texture, wherein the coordinates are based on the lower left corner of the rectangular texture; S303: Determine the area of the small texture in the aggregated texture according to the texture relative position coordinates and the width and height of the texture obtained in step S302; S304: writing the RGBA data of each small texture obtained in step S1 into the corresponding area of the aggregate texture one by one, generating an aggregate texture, and completing the texture merging operation.
5. The small texture aggregation automatic mapping method for three-dimensional models according to claim 4 is characterized in that: The specific steps of step S4 are: S401: deeply traverse each face and vertex of the 3D model. When a textured face is traversed, record the texture information of the face, then continue to traverse each vertex of the face and record the texture mapping of each vertex. uv coordinate; S402: Exploitation uv Coordinate transformation formula, the mapping obtained in step S401 uv Coordinate conversion to relative to the aggregate texture map uv Coordinates, the specific formula is: ; ; in, u Represents the texture mapping coordinates of the vertex before transformation u coordinate, v Represents the texture mapping coordinates of the vertex before transformation v coordinate, x Indicates the size of the small texture in the aggregate texture x coordinate, y Indicates the size of the small texture in the aggregate texture y coordinate, width Indicates the width of the small texture, height Indicates the height of the small texture, U Represents the texture mapping coordinates of the transformed point u coordinate, V Represents the texture mapping coordinates of the transformed point v coordinate; S403: importing the aggregated texture obtained in step S3 into the texture palette, obtaining texture index information of the aggregated texture, and writing the index information into the surface traversed in step S401; S404: Combine the relative uv The coordinates and the texture index information of the aggregated texture obtained in step S403 complete the automatic remapping of the three-dimensional model of the aggregated texture.
Citation Information
Patent Citations
Encasement method and device, electronic equipment and storage medium
CN117557177A