Texture multiplexing method and device, electronic equipment and storage medium

By segmenting texture maps and redirecting texture coordinates downsampling, the GPU and memory pressure problems caused by rendering a large number of illuminated textures are solved, and more efficient texture rendering is achieved.

CN119206018APending Publication Date: 2024-12-27SANDBOX NETWORK TECH
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202411153915.6
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-08-21
Publication Date
2024-12-27

AI Technical Summary

Technical Problem

In the prior art, rendering of large amounts of lighting textures will result in increased performance pressure and memory pressure, resulting in performance losses.

Method used

By obtaining the pending texture map for segmentation, finding matching texture submaps, redirecting texture coordinates, and downsampling based on new texture coordinates, reducing the number of textures, reducing memory usage and GPU performance pressure.

Benefits of technology

It achieves reducing the number of textures, reducing memory usage and GPU performance pressure, and improving rendering speed and effect.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119206018A_ABST
    Figure CN119206018A_ABST
Patent Text Reader

Abstract

The invention provides a texture multiplexing method and device, electronic equipment and a storage medium, and the method comprises the steps: obtaining a to-be-processed texture map, and segmenting the texture map to obtain a plurality of sub-graphs; the sub-graphs are in one-to-one correspondence with the texture sub-graphs; taking each texture sub-graph as a first texture sub-graph, and searching a second texture sub-graph matched with the first texture sub-graph; redirecting the texture coordinate of the first texture sub-graph to the texture coordinate of the second texture sub-graph, and calculating the new texture coordinate of the triangular surface vertex in the first texture sub-graph; and performing downsampling according to the new texture coordinates of the vertexes of the triangular surfaces in each texture sub-graph, and drawing the new texture coordinates on a new picture to obtain a reduced new texture map. According to the method, redirection is carried out by searching the matched texture sub-graph, the new texture coordinates of the vertexes of the triangular surfaces in the texture sub-graph are calculated, and downsampling is carried out, so that texture multiplexing can be realized, the number of textures is reduced, memory pressure during texture storage is reduced, and memory occupation and GPU performance pressure in the rendering process are reduced.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology, and in particular to a texture multiplexing method, device, electronic equipment and storage medium. Background Art

[0002] Texture is a kind of map, which is usually widely used on the surface of the model to make the model show rich details. Baking refers to the process of saving the global illumination information of the 3D mesh model into a texture. When the illumination event occurs, the illumination texture is directly rendered to show the illumination effect, so there is no need to calculate the illumination information in real time, which can save performance overhead, improve rendering speed, and make the illumination effect more realistic. It can maintain a higher rendering effect while maintaining a faster rendering speed.

[0003] However, baking will generate a large number of lighting textures. Saving a large number of lighting textures will increase memory pressure. Moreover, if there are too many lighting textures during the rendering process, the number of context switches and drawing calls will increase, which will not only increase memory usage, but also increase the performance pressure of the graphics processing unit (GPU). Summary of the invention

[0004] The present invention provides a texture multiplexing method, device, electronic device and storage medium, which are used to solve the defect in the prior art that rendering a large number of lighting textures leads to increased GPU performance pressure and memory pressure, thereby reducing the number of textures, reducing memory pressure, and reducing GPU performance pressure.

[0005] The present invention provides a texture multiplexing method, comprising: Acquire a texture map to be processed, segment the texture map to obtain a plurality of sub-graphs; the sub-graphs and the texture sub-graphs of the texture map Figure 1 One to one correspondence; Taking each texture sub-image as a first texture sub-image, searching for a second texture sub-image matching the first texture sub-image; the second texture sub-image is a texture sub-image other than the first texture sub-image; Redirecting the texture coordinates of the first texture sub-map to the texture coordinates of the second texture sub-map, and calculating new texture coordinates of the triangle vertices in the first texture sub-map; The new texture coordinates of the triangle vertices in each texture sub-image are downsampled and drawn onto the new image to obtain a reduced new texture map.

[0006] According to a texture reuse method provided by the present invention, redirecting the texture coordinates of the first texture sub-map to the texture coordinates of the second texture sub-map, and calculating new texture coordinates of the triangle surface vertices in the first texture sub-map, comprises: Select any triangle vertex in the first texture sub-map as a first triangle vertex, select any triangle vertex in the second texture sub-map as a second triangle vertex, and calculate the texture coordinate difference between the first triangle vertex and the second triangle vertex; Determining new texture coordinates of the first triangular surface vertices based on the texture coordinate difference; According to the new texture coordinates of the first triangular surface vertices, new texture coordinates of each triangular surface vertex in the first texture sub-image are determined.

[0007] According to a texture reuse method provided by the present invention, the calculating of the texture coordinate difference between the first triangular surface vertex and the second triangular surface vertex includes: Calculating temporary texture coordinates of the vertices of the first triangle surface; The difference between the temporary texture coordinates of the first triangular surface vertices and the texture coordinates of the second triangular surface vertices is calculated.

[0008] According to a texture reuse method provided by the present invention, the calculating of temporary texture coordinates of the first triangular surface vertices includes: Selecting a first graphic vertex and a second graphic vertex located in the same direction from the sub-graphics corresponding to the first texture sub-graphic and the second texture sub-graphic respectively; The temporary texture coordinates of the first triangular surface vertex are calculated according to the texture coordinate difference between the first graphic vertex and the second graphic vertex, and the texture coordinate difference between the first triangular surface vertex and the first graphic vertex.

[0009] According to a texture reuse method provided by the present invention, determining new texture coordinates of the first triangular surface vertices based on the texture coordinate difference includes: For the second texture sub-map that matches the first texture sub-map and the first texture sub-map that does not match the second texture sub-map, re-perform two-dimensional expansion of the three-dimensional model to obtain new texture coordinates of the vertices of the second triangular face; New texture coordinates of the vertices of the first triangular surface are calculated according to the new texture coordinates of the vertices of the second triangular surface and the texture coordinate difference.

[0010] According to a texture reuse method provided by the present invention, determining the new texture coordinates of each triangular surface vertex in the first texture sub-map according to the new texture coordinates of the first triangular surface vertex includes: Calculate the difference between the new texture coordinates and the old texture coordinates of the vertices of the first triangle; The difference between the new texture coordinates and the old texture coordinates is subtracted from the old texture coordinates of the other triangular face vertices except the first triangular face vertex in the first texture sub-image, so as to obtain the new texture coordinates of each triangular face vertex in the first texture sub-image.

[0011] According to a texture multiplexing method provided by the present invention, the step of searching for a second texture sub-image matching the first texture sub-image comprises: A second texture sub-image having at least a portion of pixel values ​​identical to those of the first texture sub-image is found.

[0012] The present invention also provides a texture multiplexing device, comprising: The acquisition module is used to acquire the texture map to be processed, segment the texture map to obtain a plurality of sub-graphs; the sub-graphs are segmented into the texture sub-graphs of the texture map; Figure 1 One to one correspondence; A matching module, configured to use each texture sub-image as a first texture sub-image, and search for a second texture sub-image matching the first texture sub-image; the second texture sub-image is a texture sub-image other than the first texture sub-image; A redirection module, used for redirecting the texture coordinates of the first texture sub-map to the texture coordinates of the second texture sub-map, and calculating new texture coordinates of the triangle vertices in the first texture sub-map; The downsampling module is used to downsample the new texture coordinates of the triangle surface vertices in each texture sub-image and draw them onto the new image to obtain a reduced new texture map.

[0013] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein when the processor executes the program, the steps of the texture multiplexing method as described in any one of the above items are implemented.

[0014] The present invention also provides a non-transitory computer-readable storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the steps of any of the above-mentioned texture multiplexing methods.

[0015] The texture reuse method, device, electronic device and storage medium provided by the present invention can realize texture reuse by searching for a second texture sub-map that matches the first texture sub-map, redirecting the texture coordinates of the first texture sub-map to the texture coordinates of the second texture sub-map, calculating new texture coordinates of the triangle surface vertices in the first texture sub-map, and downsampling according to the new texture coordinates, thereby reducing the number of textures, reducing the memory pressure when saving textures, and reducing the memory usage and GPU performance pressure during the rendering process. BRIEF DESCRIPTION OF THE DRAWINGS

[0016] In order to more clearly illustrate the technical solutions in the present invention or the prior art, the following briefly introduces the drawings required for use in the embodiments or the description of the prior art. Obviously, the drawings described below are some embodiments of the present invention. For ordinary technicians in this field, other drawings can be obtained based on these drawings without paying creative work.

[0017] Figure 1 It is a flowchart of a texture multiplexing method provided by an embodiment of the present invention.

[0018] Figure 2 It is a schematic diagram of a UV map provided by an embodiment of the present invention.

[0019] Figure 3 It is a schematic diagram of graphic vertex selection provided by an embodiment of the present invention.

[0020] Figure 4 It is a schematic diagram of the structure of a texture multiplexing device provided in an embodiment of the present invention.

[0021] Figure 5 It is a schematic diagram of the structure of an electronic device provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0022] In order to make the purpose, technical solution and advantages of the present invention clearer, the technical solution of the present invention will be clearly and completely described below in conjunction with the drawings of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0023] Figure 1 is a flow chart of a texture reuse method provided by an embodiment of the present invention. Figure 1 The embodiment of the present invention provides a texture multiplexing method, which may specifically include the following steps: Step 101, obtain a texture map to be processed, segment the texture map to obtain a plurality of sub-graphs; the sub-graphs and the texture sub-graphs of the texture map are segmented into a plurality of sub-graphs; Figure 1 One to one correspondence.

[0024] The execution subject of the texture reuse method provided in the embodiment of the present invention may be a computer device, and the computer device may be a terminal device or a server. In the case where the execution subject of the texture reuse method is a server, the server may obtain a texture map to be processed from the terminal device, thereby executing the texture reuse method. The terminal device may be an intelligent terminal, a computer, a personal digital assistant (PDA), a tablet computer, etc.

[0025] The texture reuse method provided by the embodiment of the present invention can be applied to scenes that require texture rendering. For example, in a lighting baking scene, the global lighting information of a three-dimensional mesh model can be saved as a lighting texture map, and the texture reuse method is performed on the lighting texture map. When a lighting event occurs, the compressed lighting texture can be rendered, thereby reducing the number of textures and reducing GPU performance pressure.

[0026] Specifically, the texture map may refer to a UV map. After UV unfolding the three-dimensional model, the UV map of the three-dimensional model to be processed may be obtained.

[0027] Among them, uv can refer to the mapping coordinate information in the computer three-dimensional model information, which can be used to define the coordinates of each point on the map. UV mapping can refer to the plane representation of the surface of the three-dimensional model, which can be used to wrap the texture. UV unfolding can refer to the process of creating a UV mapping for a three-dimensional model, that is, the two-dimensional unfolding of the three-dimensional model.

[0028] The texture sub-map of a texture map can be represented by a chart. A texture map can contain multiple charts. A chart can be composed of triangular faces with common edges and vertices after UV unfolding of a 3D model. There are no shared edges and vertices between different charts.

[0029] As a UV map example, refer to Figure 2 , which is a schematic diagram of a UV map provided by an embodiment of the present invention. After UV expansion of a cube 3D model (as shown in the left figure), a UV expansion diagram of the cube 3D model can be obtained (as shown in the right figure). The UV expansion diagram includes 6 charts, and the 6 charts correspond to the 6 faces of the cube according to the UV coordinates of their respective vertices.

[0030] Specifically, after obtaining the texture map to be processed, the bounding rectangle corresponding to each texture sub-map in the texture map can be determined; the texture map can be segmented according to the bounding rectangles corresponding to all texture sub-maps to obtain multiple sub-graphs. Figure 1 One to one correspondence.

[0031] Step 102: Take each texture sub-image as a first texture sub-image, and search for a second texture sub-image that matches the first texture sub-image; the second texture sub-image is a texture sub-image other than the first texture sub-image.

[0032] The first texture sub-graph may be represented by chart 1, and the second texture sub-graph matching the first texture sub-graph may be represented by chart 2. For each chart in each sub-graph, each chart may be used as chart 1, and chart 2 matching the chart 1 may be searched from charts in other sub-graphs.

[0033] It should be noted that chart2 matching chart1 can be searched from charts in all other sub-graphs; chart2 matching chart1 can also be searched from charts in other sub-graphs, and the present invention does not make any limitation thereto.

[0034] For example, suppose that the texture map is segmented to obtain 4 sub-graphs, and the 4 sub-graphs correspond to chart a, chart b, chart c, and chart d. A chart matching chart a can be found from chart b, chart c, and chart d; a chart matching chart b can be found from chart a, chart c, and chart d; a chart matching chart c can be found from chart a, chart b, and chart d; and a chart matching chart d can be found from chart a, chart b, and chart c.

[0035] Optionally, before searching for a second texture sub-image matching the first texture sub-image, all texture sub-images may be fuzzy processed, and matching may be performed based on the fuzzy processed texture sub-images. Specifically, a fuzzy algorithm may be used to fuzzy process all texture sub-images.

[0036] Step 103: redirecting the texture coordinates of the first texture sub-map to the texture coordinates of the second texture sub-map, and calculating new texture coordinates of the triangle vertices in the first texture sub-map.

[0037] Texture coordinates may refer to uv coordinates, which can be represented by (u, v), where u is the horizontal coordinate value and v is the vertical coordinate value, and the range of u and v is 0 to 1.

[0038] Redirection refers to the process of transferring a resource or target from its original location or path to another location or path. In an embodiment of the present invention, when a second texture submap matching the first texture submap is found, the uv coordinates of the first texture submap can be redirected to the uv coordinates of the second texture submap, thereby determining the position of the first texture submap in the second texture submap. If a second texture submap matching the first texture submap is not found, the uv coordinates of the first texture submap can be kept unchanged.

[0039] In one embodiment, when multiple texture submaps matching the first texture submap are found, the texture submap with the highest matching degree can be selected as the second texture submap, and the texture coordinates of the first texture submap can be redirected to the texture coordinates of the second texture submap.

[0040] A 3D model may be composed of multiple triangular faces. A texture submap may contain multiple triangular faces, and a texture submap may contain multiple triangular face vertices. After redirecting the uv coordinates of the first texture submap to the uv coordinates of the second texture submap, the new uv coordinates of all the triangular face vertices in the first texture submap may be calculated.

[0041] Step 104 , downsampling is performed according to the new texture coordinates of the triangle surface vertices in each texture sub-image and the texture coordinates are drawn onto the new image to obtain a reduced new texture map.

[0042] According to the calculated new UV coordinates of each triangle vertex in the texture sub-image, each corresponding triangle can be downsampled and drawn onto the new image, thereby obtaining a reduced new texture map.

[0043] The embodiment of the present invention searches for a second texture submap that matches the first texture submap, redirects the texture coordinates of the first texture submap to the texture coordinates of the second texture submap, calculates new texture coordinates of the triangle vertices in the first texture submap, and downsamples according to the new texture coordinates. This can achieve texture reuse, thereby reducing the number of textures, reducing memory pressure when saving textures, and reducing memory usage and GPU performance pressure during rendering.

[0044] In an optional embodiment, the step 103 may include the following sub-steps S11-S13: Sub-step S11, selecting any triangular face vertex in the first texture sub-map as a first triangular face vertex, selecting any triangular face vertex in the second texture sub-map as a second triangular face vertex, and calculating the texture coordinate difference between the first triangular face vertex and the second triangular face vertex; Sub-step S12, determining new texture coordinates of the first triangular face vertices based on the texture coordinate difference; Sub-step S13: determining new texture coordinates of each triangular surface vertex in the first texture sub-map according to the new texture coordinates of the first triangular surface vertex.

[0045] A triangular surface vertex can be randomly selected from multiple triangular surface vertices of the first texture sub-map and marked as P1, and a triangular surface vertex can be randomly selected from multiple triangular surface vertices of the second texture sub-map and marked as P2, so as to calculate the uv coordinate difference between the first triangular surface vertex P1 and the second triangular surface vertex P2, and save the index value of P2 and the uv coordinate difference between P1 and P2.

[0046] The new uv coordinate of P1 can be determined based on the uv coordinate difference between P1 and P2, and the new uv coordinate of each triangle vertex in chart1 can be determined according to the new uv coordinate of P1.

[0047] In an optional embodiment, the step of calculating the texture coordinate difference between the first triangular surface vertex and the second triangular surface vertex in the sub-step S11 may include the following sub-steps S111-S112: Sub-step S111, calculating temporary texture coordinates of the vertices of the first triangle surface; Sub-step S112, calculating the difference between the temporary texture coordinates of the first triangular surface vertices and the texture coordinates of the second triangular surface vertices.

[0048] The temporary texture coordinates of the first triangle vertex may refer to the texture coordinates of the first triangle vertex in the first texture submap when redirecting the texture coordinates of the first texture submap to the texture coordinates of the second texture submap. The temporary texture coordinates of the first triangle vertex P1 may be represented by (u1', v1'), and the new texture coordinates may be represented by (u1", v1").

[0049] The temporary texture coordinates (u1', v1') of P1 can be calculated, and then the uv coordinate difference between P1 and P2 can be calculated.

[0050] In an optional embodiment, the sub-step S111 may include the following sub-steps S1111-S1112: Sub-step S1111, selecting a first graphic vertex and a second graphic vertex located in the same direction from the sub-graphics corresponding to the first texture sub-graphic and the second texture sub-graphic respectively; Sub-step S1112, calculating temporary texture coordinates of the first triangular surface vertex according to the texture coordinate difference between the first graphic vertex and the second graphic vertex, and the texture coordinate difference between the first triangular surface vertex and the first graphic vertex.

[0051] The first graphic vertex may be marked as Q1, and the second graphic vertex may be marked as Q2. Graphic vertices located in the same direction may be selected from the sub-graphs corresponding to the first texture sub-graph and the second texture sub-graph as Q1 and Q2, respectively.

[0052] For example, refer to Figure 3 , is a schematic diagram of selecting graphic vertices provided by an embodiment of the present invention. The small rectangle can represent the sub-graphic corresponding to chart1, the small triangular face can represent the triangular face in the chart, the large rectangle can represent the sub-graphic corresponding to chart2 matching chart1, the large triangular face can represent the triangular face in chart2, and the graphic vertices located in the upper left corner direction can be selected as the first graphic vertex Q1 and the second graphic vertex Q2 respectively. Optionally, the graphic vertices located in the upper right corner direction, the lower left corner direction or the lower right corner direction can also be selected as Q1 and Q2 respectively, and the present invention is not limited here.

[0053] The temporary uv coordinate of P1 can be calculated based on the uv coordinate difference between Q1 and Q2, and the uv coordinate difference between P1 and Q1. Specifically, the temporary uv coordinate of P1 can be obtained by subtracting the uv coordinate difference between Q1 and P1 from the uv coordinate difference between Q2 and Q1; or by subtracting the uv coordinate difference between P1 and Q1 from the uv coordinate difference between Q1 and Q2.

[0054] In an optional embodiment, the sub-step S12 may include the following sub-steps S121-S122: Sub-step S121, re-two-dimensionally unfolding the three-dimensional model for the second texture sub-map that matches the first texture sub-map and the first texture sub-map that does not match the second texture sub-map, to obtain new texture coordinates of the vertices of the second triangle surface; Sub-step S122, calculating new texture coordinates of the vertices of the first triangular surface according to the new texture coordinates of the vertices of the second triangular surface and the texture coordinate difference.

[0055] For the second texture submap that matches the first texture submap, and the first texture submap that does not match the second texture submap, the 3D model UV expansion can be re-performed, that is, the first texture submap that has matched the second texture submap does not participate in the 3D model UV expansion, thereby obtaining the new UV coordinate of the triangle vertex P2 in the second texture submap.

[0056] According to the new uv coordinate of P2 and the difference between the uv coordinates of P1 and P2, the new uv coordinate of the triangle vertex P1 can be calculated. Specifically, the new uv coordinate of P1 can be obtained by subtracting the difference between the uv coordinates of P2 and P1 from the new uv coordinate of P2.

[0057] In an optional embodiment, the sub-step S13 may include the following sub-steps S131-S132: Sub-step S131, calculating the difference between the new texture coordinates and the old texture coordinates of the vertices of the first triangle surface; Sub-step S132, subtracting the difference between the new texture coordinates and the old texture coordinates from the old texture coordinates of the other triangular face vertices except the first triangular face vertex in the first texture sub-image, to obtain new texture coordinates of each triangular face vertex in the first texture sub-image.

[0058] The old texture coordinates of the first triangle vertex may refer to the texture coordinates of the first triangle vertex in the first texture submap before redirecting the texture coordinates of the first texture submap to the texture coordinates of the second texture submap. The old texture coordinates of the triangle vertex P1 may be represented by (u1, v1). The difference between the new texture coordinates and the old texture coordinates of P1 (u1"-u1, v1"-v1) may be calculated, and the difference (u1"-u1, v1"-v1) may be subtracted from the old texture coordinates of all other triangle vertices in the first texture submap to obtain the new texture coordinates of all triangle vertices in the first texture submap.

[0059] In an optional embodiment, searching for a second texture sub-image matching the first texture sub-image includes searching for a second texture sub-image having at least a portion of pixel values ​​identical to those of the first texture sub-image.

[0060] A texture sub-image may include multiple pixels, and a pixel may be represented by (x, y), where x may refer to a pixel position and y may refer to a pixel value.

[0061] When the second texture sub-map has the same part as the first texture sub-map, it can be determined that the second texture sub-map matches the first texture sub-map. It can be determined whether the second texture sub-map has the same part as the first texture sub-map based on at least part of the pixel values ​​in the first texture sub-map and the second texture sub-map, and then determine that the second texture sub-map matches the first texture sub-map. Specifically, if part of the pixel values ​​or all of the pixel values ​​in the second texture sub-map are the same as part of the pixel values ​​or all of the pixel values ​​in the first texture sub-map, it can be said that the second texture sub-map matches the first texture sub-map.

[0062] It should be noted that in a sub-graph, there may be a null value between the texture sub-graph and the circumscribed rectangular frame. After obtaining multiple sub-graphs, for each sub-graph, the pixel value of the texture sub-graph can be determined from the sub-graph, and matching can be performed based on the pixel value of the texture sub-graph, and matching is not performed based on the pixel values ​​of other areas in the sub-graph except the texture sub-graph, so that matching can be performed based on the effective value of the pixel.

[0063] The embodiment of the present invention searches for a second texture submap that matches the first texture submap, redirects the texture coordinates of the first texture submap to the texture coordinates of the second texture submap, calculates new texture coordinates of the triangle vertices in the first texture submap, and downsamples according to the new texture coordinates. This can achieve texture reuse, thereby reducing the number of textures, reducing memory pressure when saving textures, and reducing memory usage and GPU performance pressure during rendering.

[0064] The texture multiplexing device provided by the present invention is described below. The texture multiplexing device described below and the texture multiplexing method described above can be referred to each other.

[0065] Figure 4 Schematic diagram of the structure of the texture multiplexing device provided by the embodiment of the present invention. Figure 4 The embodiment of the present invention provides a texture multiplexing device, which may specifically include the following modules: The acquisition module 401 is used to acquire a texture map to be processed, segment the texture map to obtain a plurality of sub-graphs; Figure 1 One to one correspondence; A matching module 402 is used to use each texture sub-image as a first texture sub-image and search for a second texture sub-image that matches the first texture sub-image; the second texture sub-image is a texture sub-image other than the first texture sub-image; A redirection module 403, configured to redirect the texture coordinates of the first texture sub-map to the texture coordinates of the second texture sub-map, and calculate new texture coordinates of the triangle vertices in the first texture sub-map; The downsampling module 404 is used to downsample the new texture coordinates of the triangle surface vertices in each texture sub-image and draw them onto the new image to obtain a reduced new texture map.

[0066] In an optional embodiment, the redirection module includes: A selection submodule, configured to select any triangular face vertex in the first texture sub-map as a first triangular face vertex, select any triangular face vertex in the second texture sub-map as a second triangular face vertex, and calculate a texture coordinate difference between the first triangular face vertex and the second triangular face vertex; A first determination submodule, configured to determine new texture coordinates of the first triangular surface vertices based on the texture coordinate difference; The second determining submodule is used to determine the new texture coordinates of each triangular surface vertex in the first texture sub-map according to the new texture coordinates of the first triangular surface vertex.

[0067] In an optional embodiment, the selection submodule includes: A coordinate calculation unit, used for calculating temporary texture coordinates of the vertices of the first triangle surface; The first difference calculation unit is used to calculate the difference between the temporary texture coordinates of the first triangle surface vertices and the texture coordinates of the second triangle surface vertices.

[0068] In an optional embodiment, the coordinate calculation unit includes: A graphic vertex selection subunit, used for selecting a first graphic vertex and a second graphic vertex located in the same direction from the sub-graphics corresponding to the first texture sub-graph and the second texture sub-graph respectively; The temporary texture coordinate calculation subunit is used to calculate the temporary texture coordinates of the first triangular surface vertex according to the texture coordinate difference between the first graphic vertex and the second graphic vertex, and the texture coordinate difference between the first triangular surface vertex and the first graphic vertex.

[0069] In an optional embodiment, the first determining submodule includes: an unfolding unit, configured to re-perform two-dimensional unfolding of the three-dimensional model for the second texture sub-map that matches the first texture sub-map and the first texture sub-map that does not match the second texture sub-map, so as to obtain new texture coordinates of the vertices of the second triangular face; The first new texture coordinate calculation unit is used to calculate the new texture coordinates of the vertices of the first triangular surface according to the new texture coordinates of the vertices of the second triangular surface and the texture coordinate difference.

[0070] In an optional embodiment, the second determining submodule includes: A second difference calculation unit, used for calculating the difference between the new texture coordinates and the old texture coordinates of the vertices of the first triangle surface; The second new texture coordinate calculation unit is used to subtract the difference between the new texture coordinates and the old texture coordinates from the old texture coordinates of the other triangle surface vertices except the first triangle surface vertex in the first texture sub-image, so as to obtain the new texture coordinates of each triangle surface vertex in the first texture sub-image.

[0071] In an optional embodiment, the matching module includes: The searching submodule is used to search for a second texture sub-image having at least a portion of pixel values ​​identical to those of the first texture sub-image.

[0072] The embodiment of the present invention searches for a second texture submap that matches the first texture submap, redirects the texture coordinates of the first texture submap to the texture coordinates of the second texture submap, calculates new texture coordinates of the triangle vertices in the first texture submap, and downsamples according to the new texture coordinates. This can achieve texture reuse, thereby reducing the number of textures, reducing memory pressure when saving textures, and reducing memory usage and GPU performance pressure during rendering.

[0073] Figure 5 An example of a physical structure diagram of an electronic device is shown in FIG. Figure 5 As shown, the electronic device may include: a processor 510, a communications interface 520, a memory 530 and a communications bus 540, wherein the processor 510, the communications interface 520 and the memory 530 communicate with each other via the communications bus 540. The processor 510 may call the logic instructions in the memory 530 to execute the texture multiplexing method, which includes: obtaining a texture map to be processed, dividing the texture map to obtain a plurality of sub-graphs; dividing the sub-graphs with the texture sub-graphs of the texture map ... Figure 1 One-to-one correspondence; taking each texture sub-map as a first texture sub-map, searching for a second texture sub-map that matches the first texture sub-map; the second texture sub-map is a texture sub-map other than the first texture sub-map; redirecting the texture coordinates of the first texture sub-map to the texture coordinates of the second texture sub-map, calculating new texture coordinates of the triangular face vertices in the first texture sub-map; downsampling according to the new texture coordinates of the triangular face vertices in each texture sub-map and drawing them onto a new picture to obtain a reduced new texture map.

[0074] In addition, the logic instructions in the above-mentioned memory 530 can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when it is sold or used as an independent product. Based on such an understanding, the technical solution of the present invention, in essence, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product, and the computer software product is stored in a storage medium, including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM, Read-Only Memory), random access memory (RAM, Random Access Memory), disk or optical disk, etc. Various media that can store program codes.

[0075] On the other hand, the present invention also provides a computer program product, the computer program product includes a computer program, the computer program can be stored in a non-transitory computer-readable storage medium, when the computer program is executed by a processor, the computer can execute the texture reuse method provided by the above methods, the method comprising: obtaining a texture map to be processed, dividing the texture map to obtain a plurality of sub-graphs; dividing the sub-graphs into texture sub-graphs of the texture map ... Figure 1 One-to-one correspondence; taking each texture sub-map as a first texture sub-map, searching for a second texture sub-map that matches the first texture sub-map; the second texture sub-map is a texture sub-map other than the first texture sub-map; redirecting the texture coordinates of the first texture sub-map to the texture coordinates of the second texture sub-map, calculating new texture coordinates of the triangular face vertices in the first texture sub-map; downsampling according to the new texture coordinates of the triangular face vertices in each texture sub-map and drawing them onto a new picture to obtain a reduced new texture map.

[0076] In another aspect, the present invention further provides a non-transitory computer-readable storage medium having a computer program stored thereon, which is implemented when the computer program is executed by a processor to perform the texture reuse method provided by the above methods, the method comprising: obtaining a texture map to be processed, dividing the texture map to obtain a plurality of sub-graphs; dividing the sub-graphs into texture sub-graphs of the texture map ... Figure 1 One-to-one correspondence; taking each texture sub-map as a first texture sub-map, searching for a second texture sub-map that matches the first texture sub-map; the second texture sub-map is a texture sub-map other than the first texture sub-map; redirecting the texture coordinates of the first texture sub-map to the texture coordinates of the second texture sub-map, calculating new texture coordinates of the triangular face vertices in the first texture sub-map; downsampling according to the new texture coordinates of the triangular face vertices in each texture sub-map and drawing them onto a new picture to obtain a reduced new texture map.

[0077] The device embodiments described above are merely illustrative, wherein the units described as separate components may or may not be physically separated, and the components displayed as units may or may not be physical units, that is, they may be located in one place, or they may be distributed on multiple network units. Some or all of the modules may be selected according to actual needs to achieve the purpose of the scheme of this embodiment. Ordinary technicians in this field can understand and implement it without paying creative labor.

[0078] Through the description of the above implementation methods, those skilled in the art can clearly understand that each implementation method can be implemented by means of software plus a necessary general hardware platform, and of course, can also be implemented by hardware. Based on this understanding, the above technical solution is essentially or the part that contributes to the prior art can be embodied in the form of a software product, and the computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a disk, an optical disk, etc., including a number of instructions for a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or some parts of the embodiments.

[0079] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the embodiments of the present invention.

Claims

1. A texture multiplexing method, characterized in that: include: Acquire a texture map to be processed, wherein the texture map includes a plurality of texture sub-maps; For a second sub-image matching the first sub-image in the matched sub-image combination and other sub-images not in the sub-image combination, re-unfold the three-dimensional model in two dimensions to obtain a new texture map and new texture coordinates of the second sub-image; The texture coordinates of the first sub-image are mapped to new texture coordinates of the second sub-image by redirection.

2. The method according to claim 1, characterized in that: Mapping the texture coordinates of the first sub-image to new texture coordinates of the second sub-image by redirecting includes: Determining a position of the first sub-image relative to the second sub-image in the matched sub-image combination; New texture coordinates of the first sub-image are determined according to the position of the first sub-image relative to the second sub-image and the new texture coordinates of the second sub-image.

3. The method according to claim 2, characterized in that The determining of the position of the first sub-image relative to the second sub-image in the matched sub-image combination includes: Select any triangle face vertex in the first sub-image as a first triangle face vertex, select any triangle face vertex in the second sub-image as a second triangle face vertex, and calculate the texture coordinate difference between the first triangle face vertex and the second triangle face vertex.

4. The method according to claim 3, characterized in that: The calculating the texture coordinate difference between the first triangular surface vertex and the second triangular surface vertex comprises: Calculating temporary texture coordinates of the vertices of the first triangle surface; The difference between the temporary texture coordinates of the first triangle surface vertices and the texture coordinates of the second triangle surface vertices is calculated.

5. The method according to claim 4, characterized in that The calculating the temporary texture coordinates of the first triangular surface vertices includes: Selecting a first figure vertex and a second figure vertex located in the same direction from the sub-figures corresponding to the first sub-figure and the second sub-figure respectively; The temporary texture coordinates of the first triangular surface vertex are calculated according to the texture coordinate difference between the first graphic vertex and the second graphic vertex, and the texture coordinate difference between the first triangular surface vertex and the first graphic vertex.

6. The method according to claim 3, characterized in that The determining the new texture coordinates of the first sub-image according to the position of the first sub-image relative to the second sub-image and the new texture coordinates of the second sub-image comprises: Calculate new texture coordinates of the first triangular surface vertices according to the texture coordinate difference and the new texture coordinates of the second triangular surface vertices in the second sub-image; According to the new texture coordinates of the first triangular surface vertices, new texture coordinates of each triangular surface vertex in the first sub-image are determined.

7. The method according to claim 6, characterized in that The step of determining new texture coordinates of each triangular surface vertex in the first sub-image according to the new texture coordinates of the first triangular surface vertex comprises: Calculate the difference between the new texture coordinates and the old texture coordinates of the vertices of the first triangle; The difference between the new texture coordinates and the old texture coordinates is subtracted from the old texture coordinates of the other triangular face vertices except the first triangular face vertex in the first sub-image, so as to obtain the new texture coordinates of each triangular face vertex in the first sub-image.

8. The method according to claim 1, characterized in that At least some pixel values ​​of the second sub-image are the same as those of the first sub-image.

9. A texture multiplexing device, characterized in that: include: An acquisition module, used for acquiring a texture map to be processed, wherein the texture map includes a plurality of texture sub-maps; An unfolding module, for re-unfolding the three-dimensional model in two dimensions for the second sub-image matching the first sub-image in the matched sub-image combination and other sub-images not in the sub-image combination, to obtain a new texture map and new texture coordinates of the second sub-image; The redirection module is used to map the texture coordinates of the first sub-image to new texture coordinates of the second sub-image through redirection.

10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the computer program, the texture multiplexing method according to any one of claims 1 to 8 is implemented.

11. A non-transitory computer-readable storage medium having a computer program stored thereon, characterized in that: When the computer program is executed by a processor, the texture multiplexing method according to any one of claims 1 to 8 is implemented.

12. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the texture multiplexing method according to any one of claims 1 to 8 is implemented.