Method, device, equipment and storage medium for generating texture map of three-dimensional model

By fusing the panoramic image with the original distance field map and color map of the three-dimensional model, the problem of high rendering performance consumption in the existing technology is solved, and a more efficient rendering process is achieved.

CN113112581BActive Publication Date: 2024-12-10GUANGDONG SANWEIJIA INFORMATION TECH CO LTD
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
CN202110524823.4
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-05-13
Publication Date
2024-12-10
Estimated Expiration
2041-05-13

AI Technical Summary

Technical Problem

The prior art has the problem of high calculation time-consuming when simulating the three-dimensional space of VR roaming scenes. Especially when rendering a three-dimensional model through ray tracing technology, it is necessary to render massive points, resulting in serious performance consumption.

Method used

By obtaining the panoramic map and three-dimensional model of the target scene, the coordinate transformation matrix is ​​used to convert the three-dimensional vertex coordinates into two-dimensional vertex coordinates, and the color and distance field information is read from the panoramic map to generate texture maps, and then the original distance field map is turned on. Fusion with color maps to reduce the number of ray tracing and reduce performance consumption.

Benefits of technology

It effectively reduces the performance consumption of the shading process of the three-dimensional model, and by fusing the texture information in the panoramic image, the number of ray tracing is reduced and the rendering efficiency is improved.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113112581B_ABST
    Figure CN113112581B_ABST
Patent Text Reader

Abstract

The present application provides a texture map generation method, device, equipment and storage medium for a three-dimensional model, wherein the method includes: obtaining a panoramic view of a target scene and a three-dimensional model of the target scene, a first distance field map of the target scene, and a first color map of the target scene; converting the three-dimensional vertex coordinates of the three-dimensional model into two-dimensional vertex coordinates according to a coordinate conversion matrix; reading color information associated with the two-dimensional vertex coordinates from the panoramic view according to the two-dimensional vertex coordinates and generating a second color map; reading distance field information associated with the two-dimensional vertex coordinates from the panoramic view according to the two-dimensional vertex coordinates and generating a second distance field map; fusing the second color map with the first color map to obtain a target color map; fusing the first distance field map with the second distance field map to obtain a target distance field map. The present application can reduce the performance consumption of the coloring process of the three-dimensional model.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of computer graphics, and in particular to a method, device, equipment and storage medium for generating texture maps of a three-dimensional model. Background Art

[0002] At present, in VR roaming scenes, it is necessary to simulate the three-dimensional sense of space in the real world. There are two main ways to simulate the three-dimensional space of the real world in the existing technology. The first is to build a three-dimensional scene based on the panoramic view of the scene, but this method can only build a small number of rotatable points, and cannot realize the three-dimensional space of the entire scene. For example, the VR house viewing function provided by Beike.com can only rotate at specific points and the rotation direction is limited. The second is to perform three-dimensional modeling through the scene, and then render the three-dimensional model through ray tracing technology. This method has the advantages of better spatial sense, color closer to the real scene, and users can observe from multiple perspectives by choice. However, since this method requires rendering of a large number of points, it has the disadvantage of high computational time. Summary of the invention

[0003] The purpose of the embodiments of the present application is to provide a method, device, equipment and storage medium for generating a texture map of a three-dimensional model, so as to reduce the performance consumption of the coloring process of the three-dimensional model.

[0004] To this end, the first aspect of the present application discloses a method for generating a texture map of a three-dimensional model, the method comprising:

[0005] Acquire a panoramic image of a target scene, a three-dimensional model of the target scene, a first distance field map of the target scene, and a first color map of the target scene;

[0006] Converting the three-dimensional vertex coordinates of the three-dimensional model into two-dimensional vertex coordinates according to a coordinate conversion matrix;

[0007] Reading color information associated with the two-dimensional vertex coordinates from the panoramic image according to the two-dimensional vertex coordinates and generating a second color map;

[0008] Reading distance field information associated with the two-dimensional vertex coordinates from the panoramic image according to the two-dimensional vertex coordinates and generating a second distance field map;

[0009] Merging the second color map with the first color map to obtain a target color map;

[0010] The first distance field map is merged with the second distance field map to obtain a target distance field map.

[0011] The method of the first aspect of the present application can reduce the performance consumption of the coloring process of the three-dimensional model. Since the panorama includes a lot of texture information of the three-dimensional model, by fusing the panorama with the original distance field map and color map of the three-dimensional model, the number of ray tracing performed to obtain the distance field map and the color map can be reduced, thereby reducing performance consumption.

[0012] In the first aspect of the present application, as an optional implementation, converting the three-dimensional vertex coordinates of the three-dimensional model into two-dimensional vertex coordinates according to the coordinate conversion matrix includes:

[0013] Converting the three-dimensional vertex coordinates of the three-dimensional model into coordinates of a rendering camera coordinate system according to the coordinate conversion matrix;

[0014] The rendering camera coordinate system coordinates are converted into the two-dimensional vertex coordinates.

[0015] In the first aspect of the present application, as an optional implementation, after converting the three-dimensional vertex coordinates of the three-dimensional model into the coordinates of the rendering camera coordinate system according to the coordinate conversion matrix, and before converting the coordinates of the rendering camera coordinate system into the two-dimensional vertex coordinates, the method further includes:

[0016] Calculate the vertex depth value according to the rendering camera coordinate system coordinates;

[0017] The vertices whose vertex depth values ​​do not satisfy the first preset condition are filtered out.

[0018] In the first aspect of the present application, as an optional implementation, after converting the rendering camera coordinate system coordinates into the two-dimensional vertex coordinates, and before reading the distance field information associated with the two-dimensional vertex coordinates from the panoramic image according to the two-dimensional vertex coordinates and generating a second distance field map, the method further includes:

[0019] Reading a color value of the two-dimensional vertex coordinate in the first distance field tile according to the two-dimensional vertex coordinate;

[0020] Calculate a first distance value according to the color value of the two-dimensional vertex coordinate in the first distance field map;

[0021] A second distance value is obtained by calculating the distance between the observation position of the rendering camera and the three-dimensional vertex of the three-dimensional model;

[0022] The two-dimensional vertex coordinates that are not visible to the rendering camera are filtered from the two-dimensional vertex coordinates according to the first distance value and the second distance value.

[0023] In the first aspect of the present application, as an optional implementation, the step of fusing the second color map with the first color map to obtain a target color map includes:

[0024] Calculate the color value of the two-dimensional vertex coordinate in the first color map and use it as the first color value;

[0025] Calculate the color value of the two-dimensional vertex coordinate in the second color map and use it as the second color value;

[0026] Calculate the distance value of the two-dimensional vertex coordinate in the first color map and use it as the third distance value;

[0027] Calculate the distance value of the two-dimensional vertex coordinate in the second color map and use it as a fourth distance value;

[0028] When the third distance value is less than the fourth distance value, the color value of the two-dimensional vertex coordinate in the target color map is set to the first color value.

[0029] In the first aspect of the present application, as an optional implementation, the step of fusing the first distance field map with the second distance field map to obtain a target distance field map includes:

[0030] When the third distance value is less than the fourth distance value, the distance value of the two-dimensional vertex coordinate in the target color map is set to the third distance value.

[0031] The second aspect of the present application discloses a texture map generating device for a three-dimensional model, the device comprising:

[0032] An acquisition module, used to acquire a panoramic image of a target scene and a three-dimensional model of the target scene, a first distance field map of the target scene, and a first color map of the target scene;

[0033] A coordinate conversion module, used for converting the three-dimensional vertex coordinates of the three-dimensional model into two-dimensional vertex coordinates according to a coordinate conversion matrix;

[0034] A generating module, configured to read color information associated with the two-dimensional vertex coordinates from the panoramic image according to the two-dimensional vertex coordinates and generate a second color map;

[0035] A reading module, configured to read distance field information associated with the two-dimensional vertex coordinates from the panoramic image according to the two-dimensional vertex coordinates and generate a second distance field map;

[0036] A first fusion module, used for fusing the second color map with the first color map to obtain a target color map;

[0037] The second fusion module is used to fuse the first distance field map with the second distance field map to obtain a target distance field map.

[0038] In the second aspect of the present application, as an optional implementation, the coordinate conversion module includes:

[0039] A first conversion submodule, used for converting the three-dimensional vertex coordinates of the three-dimensional model into the coordinates of the rendering camera coordinate system according to the coordinate conversion matrix;

[0040] The second conversion submodule is used to convert the coordinates of the rendering camera coordinate system into the two-dimensional vertex coordinates.

[0041] In the embodiment of the present application, since the panoramic image includes a lot of texture information of the three-dimensional model, by fusing the panoramic image with the original distance field map and color map of the three-dimensional model, the number of ray tracing performed to obtain the distance field map and the color map can be reduced, thereby reducing performance consumption.

[0042] The third aspect of the present application discloses a texture map generation device for a three-dimensional model, the device comprising:

[0043] A memory storing executable program code;

[0044] a processor coupled to the memory;

[0045] The processor calls the executable program code stored in the memory to execute the texture map generation method for the three-dimensional model of the first aspect of the present application.

[0046] The texture map generation device for a three-dimensional model in the third aspect of the present application can reduce the performance consumption of the coloring process of the three-dimensional model by executing the texture map generation method for the three-dimensional model. Since the panoramic image includes a lot of texture information of the three-dimensional model, the panoramic image is merged with the original distance field map and color map of the three-dimensional model. The number of ray tracing performed to obtain the distance field map and the color map can be reduced, thereby reducing performance consumption.

[0047] The fourth aspect of the present application discloses a storage medium, which stores computer instructions. When the computer instructions are called, they are used to execute the texture mapping generation method of the three-dimensional model of the first aspect of the present application.

[0048] The texture map generation device for a three-dimensional model in the fourth aspect of the present application can reduce the performance consumption of the coloring process of the three-dimensional model by executing the texture map generation method for the three-dimensional model. Since the panoramic image includes a lot of texture information of the three-dimensional model, the panoramic image is merged with the original distance field map and color map of the three-dimensional model. The number of ray tracing performed to obtain the distance field map and the color map can be reduced, thereby reducing performance consumption. BRIEF DESCRIPTION OF THE DRAWINGS

[0049] In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings required for use in the embodiments of the present application will be briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present application and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without paying creative work.

[0050] Figure 1 It is a flow chart of a method for generating a texture map of a three-dimensional model disclosed in an embodiment of the present application;

[0051] Figure 2 It is a structural schematic diagram of a texture map generating device for a three-dimensional model disclosed in an embodiment of the present application;

[0052] Figure 3 It is a structural schematic diagram of a texture mapping generation device for a three-dimensional model disclosed in an embodiment of the present application. DETAILED DESCRIPTION

[0053] The technical solutions in the embodiments of the present application will be described below in conjunction with the drawings in the embodiments of the present application.

[0054] Embodiment 1

[0055] See also Figure 1 , Figure 1 FIG. 1 is a flow chart of a method for generating a texture map of a three-dimensional model disclosed in an embodiment of the present application. Figure 1 As shown, the method of the embodiment of the present application includes the steps of:

[0056] 101. Acquire a panoramic image of a target scene, a three-dimensional model of the target scene, a first distance field map of the target scene, and a first color map of the target scene;

[0057] 102. Convert the three-dimensional vertex coordinates of the three-dimensional model into two-dimensional vertex coordinates according to the coordinate conversion matrix;

[0058] 103. Read color information associated with the two-dimensional vertex coordinates from the panoramic image according to the two-dimensional vertex coordinates and generate a second color map;

[0059] 104. Read distance field information associated with the two-dimensional vertex coordinates from the panoramic image according to the two-dimensional vertex coordinates and generate a second distance field map;

[0060] 105. Merge the second color map with the first color map to obtain a target color map;

[0061] 106. The first distance field map is merged with the second distance field map to obtain a target distance field map.

[0062] In an embodiment of the present application, as an example, assume that there is a three-dimensional model to be colored. At this time, the three-dimensional model will be associated with a texture mapping, and the texture mapping includes a coordinate transformation matrix relationship, that is, the three-dimensional vertex coordinates of the three-dimensional model can be converted into rendering camera coordinate system coordinates through the coordinate transformation matrix, wherein the rendering camera coordinate system coordinates are two-dimensional coordinates, for example, mapping the surface vertex p of the three-dimensional model into plane coordinates (u, v).

[0063] Then, when the plane coordinates (u, v) are obtained, the plane coordinates (u, v) can be used as a basis for searching, and the pixel corresponding to the plane coordinates (u, v) can be found on the original texture map of the scene corresponding to the 3D model, and the color value and depth value of the pixel can be read as the rendering information of the 3D model to complete the rendering of the 3D model. It should be noted that the texture map of the 3D model includes a distance field map and a color map, wherein the distance field map carries the depth value representing the front-back relationship of the pixel point. During the rendering process, the front-back relationship and occlusion relationship of each vertex in the model can be clarified based on the distance field map.

[0064] Furthermore, the information associated with each pixel point in the original texture map of the three-dimensional model needs to be obtained in advance. The current existing technology mainly uses ray tracing technology to obtain the information associated with each pixel point of the original texture map. However, the original texture map has a large number of pixels. If the information associated with each pixel point is obtained through tracing technology, it will lead to serious computer performance consumption and low rendering efficiency. To address this problem, the embodiment of the present application reads the information associated with each pixel point from the panoramic map of the target scene through steps 103 and 104 after steps 101 and 102. In this way, since the panoramic map itself has the information associated with the pixels, and the information associated with the pixels of the panoramic map is associated with a two-dimensional coordinate, the information associated with the pixels in the panoramic map can be used as the information associated with the pixels in the texture map through the two-dimensional coordinate. Then, through steps 105 and 106, the original information associated with the pixels on the texture map and the information obtained from the panoramic map can be merged, thereby avoiding the use of ray tracing technology to obtain the information associated with each pixel point, while being able to obtain a complete texture map for rendering the three-dimensional model.

[0065] Specifically, a 3D model has six faces. In order to render all six faces of the 3D model, the texture map corresponding to each face and the panorama corresponding to the face can be obtained in sequence, and the six faces can be rendered in sequence. It should be noted that the target scene can be a bedroom, a living room, an exhibition hall, etc.

[0066] In the embodiment of the present application, the first distance scene map may be generated by a GPU, wherein, for how the GPU specifically generates the first distance field map, please refer to the prior art.

[0067] In the embodiment of the present application, the coordinate conversion matrix can convert the world coordinate system coordinates of the three-dimensional model into the camera coordinate system coordinates. Accordingly, step 102: converting the three-dimensional vertex coordinates of the three-dimensional model into two-dimensional vertex coordinates according to the coordinate conversion matrix is ​​specifically:

[0068] The world coordinates of the 3D model are converted into the camera coordinate system coordinates through the coordinate transformation matrix;

[0069] The camera coordinate system coordinates are converted into two-dimensional coordinates through projection coordinate transformation.

[0070] In the embodiment of the present application, since the panoramic image includes a lot of texture information of the three-dimensional model, by fusing the panoramic image with the original distance field map and color map of the three-dimensional model, the number of ray tracing performed to obtain the distance field map and the color map can be reduced, thereby reducing performance consumption.

[0071] In the embodiment of the present application, as an optional implementation, step 102: converting the three-dimensional vertex coordinates of the three-dimensional model into two-dimensional vertex coordinates according to the coordinate conversion matrix, includes sub-steps:

[0072] The three-dimensional vertex coordinates of the three-dimensional model are converted into the coordinates of the rendering camera coordinate system according to the coordinate transformation matrix;

[0073] Converts the rendering camera coordinate system coordinates to two-dimensional vertex coordinates.

[0074] In the embodiment of the present application, as an optional implementation, after the step of converting the three-dimensional vertex coordinates of the three-dimensional model into the coordinates of the rendering camera coordinate system according to the coordinate conversion matrix, and before the step of converting the coordinates of the rendering camera coordinate system into the two-dimensional vertex coordinates, the method of the embodiment of the present application further includes:

[0075] Calculate the vertex depth value according to the rendering camera coordinate system coordinates;

[0076] Vertices whose vertex depth values ​​do not satisfy the first preset condition are filtered.

[0077] In this optional implementation, by calculating the vertex depth values ​​according to the coordinates of the rendering camera coordinate system, vertices whose vertex depth values ​​do not meet the first preset condition can be filtered.

[0078] In this optional implementation, the first preset condition may be to fill in the depth value with 0. For example, for a vertex that is not colored by the panorama, the color and distance field of the point are both 0. At this time, the point can be filtered so that there is no need to obtain the corresponding information of the point from the panorama. In the embodiment of the present application, as an optional implementation, after the step of converting the coordinates of the rendering camera coordinate system into two-dimensional vertex coordinates, and before the step of reading the distance field information associated with the two-dimensional vertex coordinates from the panorama according to the two-dimensional vertex coordinates and generating a second distance field map, the method of the embodiment of the present application also includes:

[0079] Read the color value of the two-dimensional vertex coordinate in the first distance field patch according to the two-dimensional vertex coordinate;

[0080] A first distance value is calculated according to the color value of the two-dimensional vertex coordinate in the first distance field map;

[0081] A second distance value is obtained by calculating the distance between the observation position of the rendering camera and the three-dimensional vertex of the three-dimensional model;

[0082] The two-dimensional vertex coordinates that are invisible to the rendering camera are filtered from the two-dimensional vertex coordinates according to the first distance value and the second distance value.

[0083] In an embodiment of the present application, by reading the color value of the two-dimensional vertex coordinates in the first distance field map according to the two-dimensional vertex coordinates, the first distance value can be calculated according to the color value of the two-dimensional vertex coordinates in the first distance field map, and the second distance value can be calculated according to the distance between the observation position of the rendering camera and the three-dimensional vertex of the three-dimensional model, and the two-dimensional vertex coordinates that are invisible to the rendering camera can be filtered from the two-dimensional vertex coordinates according to the first distance value and the second distance value.

[0084] In the embodiment of the present application, as an optional implementation, step 105: fusing the second color map with the first color map to obtain a target color map includes:

[0085] Calculate the color value of the two-dimensional vertex coordinate in the first color map and use it as the first color value;

[0086] Calculate the color value of the two-dimensional vertex coordinate in the second color map and use it as the second color value;

[0087] Calculate the distance value of the two-dimensional vertex coordinates in the first color map and use it as the third distance value;

[0088] Calculate the distance value of the two-dimensional vertex coordinates in the second color map and use it as the fourth distance value;

[0089] When the third distance value is less than the fourth distance value, the color value of the two-dimensional vertex coordinate in the target color map is set to the first color value.

[0090] In this optional embodiment, by calculating the color value of the two-dimensional vertex coordinates in the first color map and using it as the first color value, calculating the color value of the two-dimensional vertex coordinates in the second color map and using it as the second color value, calculating the distance value of the two-dimensional vertex coordinates in the first color map and using it as the third distance value, and calculating the distance value of the two-dimensional vertex coordinates in the second color map and using it as the fourth distance value, the color value of the two-dimensional vertex coordinates in the target color map can be set to the first color value when the third distance value is less than the fourth distance value.

[0091] In this optional implementation, the calculation of color value and distance value can be realized by unpack in the prior art, wherein, since each pixel on the image is represented by a four-dimensional vector (r, g, b, a), but the precision of each bit is only 8 bits, that is, each bit is an integer, and can only be an integer between 0 and 255, and the distance value is a real number, that is, a floating point type, and the precision requirement is high, so it is necessary to convert the four-dimensional vector (r, g, b, a) into floating point data, and at this time, unpack is to convert the four-dimensional vector (r, g, b, a) into floating point data.

[0092] In the embodiment of the present application, as an optional implementation, step 106: fusing the first distance field map with the second distance field map to obtain a target distance field map includes:

[0093] When the third distance value is less than the fourth distance value, the distance value of the two-dimensional vertex coordinate in the target color map is set to the third distance value.

[0094] In this optional implementation, when the third distance value is less than the fourth distance value, the distance value of the two-dimensional vertex coordinate in the target color map may be set to the third distance value.

[0095] Embodiment 2

[0096] See also Figure 2 , Figure 2 1 is a flow chart of a texture map generation device for a three-dimensional model disclosed in an embodiment of the present application. Figure 2 As shown, the device of the embodiment of the present application includes:

[0097] An acquisition module 201 is used to acquire a panoramic image of a target scene, a three-dimensional model of the target scene, a first distance field map of the target scene, and a first color map of the target scene;

[0098] A coordinate conversion module 202, for converting the three-dimensional vertex coordinates of the three-dimensional model into two-dimensional vertex coordinates according to the coordinate conversion matrix;

[0099] A generating module 203, configured to read color information associated with two-dimensional vertex coordinates from the panoramic image according to the two-dimensional vertex coordinates and generate a second color map;

[0100] A reading module 204, configured to read distance field information associated with two-dimensional vertex coordinates from the panoramic image according to the two-dimensional vertex coordinates and generate a second distance field map;

[0101] A first fusion module 205, used to fuse the second color map with the first color map to obtain a target color map;

[0102] The second fusion module 206 is used to fuse the first distance field map with the second distance field map to obtain a target distance field map.

[0103] In the embodiment of the present application, as an optional implementation, the coordinate conversion module includes:

[0104] A first conversion submodule, used for converting the three-dimensional vertex coordinates of the three-dimensional model into the coordinates of the rendering camera coordinate system according to the coordinate conversion matrix;

[0105] The second conversion submodule is used to convert the coordinates of the rendering camera coordinate system into two-dimensional vertex coordinates.

[0106] In the embodiment of the present application, the target scene may be a bedroom, a living room, an exhibition hall, or the like.

[0107] In the embodiment of the present application, the first distance scene map may be generated by a GPU, wherein please refer to the prior art for how the GPU specifically generates the first distance field map.

[0108] In the embodiment of the present application, the coordinate conversion matrix can convert the world coordinate system coordinates of the three-dimensional model into the camera coordinate system coordinates. Accordingly, step 102: converting the three-dimensional vertex coordinates of the three-dimensional model into two-dimensional vertex coordinates according to the coordinate conversion matrix is ​​specifically:

[0109] The world coordinates of the 3D model are converted into the camera coordinate system coordinates through the coordinate transformation matrix;

[0110] The camera coordinate system coordinates are converted into two-dimensional coordinates through projection coordinate transformation.

[0111] In the embodiment of the present application, since the panoramic image includes a lot of texture information of the three-dimensional model, by fusing the panoramic image with the original distance field map and color map of the three-dimensional model, the number of ray tracing performed to obtain the distance field map and the color map can be reduced, thereby reducing performance consumption.

[0112] Embodiment 3

[0113] See also Figure 3 , Figure 3 1 is a flow chart of a texture map generation device for a three-dimensional model disclosed in an embodiment of the present application. Figure 3 As shown, the device of the embodiment of the present application includes:

[0114] A memory 301 storing executable program codes;

[0115] a processor 302 coupled to a memory;

[0116] The processor calls the executable program code stored in the memory to execute the texture mapping generation method of the three-dimensional model of the first embodiment of the present application.

[0117] The device of the embodiment of the present application can reduce the performance consumption of the coloring process of the three-dimensional model by executing the texture map generation method of the three-dimensional model. Among them, since the panoramic image includes a lot of texture information of the three-dimensional model, by fusing the panoramic image with the original distance field map and color map of the three-dimensional model, the number of ray tracing performed to obtain the distance field map and the color map can be reduced, thereby reducing performance consumption.

[0118] Embodiment 4

[0119] An embodiment of the present application discloses a storage medium, which stores computer instructions. When the computer instructions are called, they are used to execute the texture mapping generation method for a three-dimensional model disclosed in the first embodiment of the present application.

[0120] The storage medium of the embodiment of the present application can reduce the performance consumption of the coloring process of the three-dimensional model by executing the texture map generation method of the three-dimensional model. Among them, since the panorama includes a lot of texture information of the three-dimensional model, by fusing the panorama with the original distance field map and color map of the three-dimensional model, the number of ray tracing performed to obtain the distance field map and the color map can be reduced, thereby reducing performance consumption. In the embodiments provided in the present application, it should be understood that the disclosed device and method can be implemented in other ways. The device embodiments described above are only schematic. For example, the division of the units is only a logical function division. There may be other division methods in actual implementation. For example, multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be through some communication interfaces, indirect coupling or communication connection of devices or units, which can be electrical, mechanical or other forms.

[0121] In addition, the units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0122] Furthermore, the functional modules in the various embodiments of the present application may be integrated together to form an independent part, or each module may exist separately, or two or more modules may be integrated to form an independent part.

[0123] It should be noted that if the function is implemented in the form of a software function module and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application can essentially be embodied in the form of a software product, or the part that contributes to the prior art or the part of the technical solution. The computer software product is stored in a storage medium, including a number of instructions to enable 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 application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory (ROM) random access memory (RAM), disk or optical disk, and other media that can store program codes.

[0124] In this document, relational terms such as first and second, etc. are used merely to distinguish one entity or operation from another entity or operation, but do not necessarily require or imply any such actual relationship or order between these entities or operations.

[0125] The above description is only an embodiment of the present application and is not intended to limit the protection scope of the present application. For those skilled in the art, the present application may have various modifications and variations. Any modification, equivalent replacement, improvement, etc. made within the spirit and principle of the present application shall be included in the protection scope of the present application.

Claims

1. A method for generating a texture map of a three-dimensional model, characterized in that: The method comprises: Acquire a panoramic image of a target scene, a three-dimensional model of the target scene, a first distance field map of the target scene, and a first color map of the target scene; Converting the three-dimensional vertex coordinates of the three-dimensional model into two-dimensional vertex coordinates according to a coordinate conversion matrix; Reading color information associated with the two-dimensional vertex coordinates from the panoramic image according to the two-dimensional vertex coordinates and generating a second color map; Reading distance field information associated with the two-dimensional vertex coordinates from the panoramic image according to the two-dimensional vertex coordinates and generating a second distance field map; Merging the second color map with the first color map to obtain a target color map; Merging the first distance field map with the second distance field map to obtain a target distance field map; And, the step of fusing the second color map with the first color map to obtain a target color map comprises: Calculate the color value of the two-dimensional vertex coordinate in the first color map and use it as the first color value; Calculate the color value of the two-dimensional vertex coordinate in the second color map and use it as the second color value; Calculate the distance value of the two-dimensional vertex coordinate in the first color map and use it as the third distance value; Calculate the distance value of the two-dimensional vertex coordinate in the second color map and use it as a fourth distance value; When the third distance value is less than the fourth distance value, the color value of the two-dimensional vertex coordinate in the target color map is set to the first color value.

2. The method according to claim 1, characterized in that The step of converting the three-dimensional vertex coordinates of the three-dimensional model into two-dimensional vertex coordinates according to the coordinate conversion matrix includes: Converting the three-dimensional vertex coordinates of the three-dimensional model into coordinates of a rendering camera coordinate system according to the coordinate conversion matrix; The rendering camera coordinate system coordinates are converted into the two-dimensional vertex coordinates.

3. The method according to claim 2, characterized in that After converting the three-dimensional vertex coordinates of the three-dimensional model into coordinates of a rendering camera coordinate system according to the coordinate conversion matrix, and before converting the coordinates of the rendering camera coordinate system into the two-dimensional vertex coordinates, the method further includes: Calculate the vertex depth value according to the rendering camera coordinate system coordinates; Filter the vertices whose vertex depth values ​​do not meet a first preset condition, wherein the first preset condition is to fill in the depth value with 0.

4. The method according to claim 3, characterized in that After converting the rendering camera coordinate system coordinates into the two-dimensional vertex coordinates and before reading the distance field information associated with the two-dimensional vertex coordinates from the panoramic image according to the two-dimensional vertex coordinates and generating a second distance field map, the method further includes: Reading a color value of the two-dimensional vertex coordinate in the first distance field map according to the two-dimensional vertex coordinate; Calculate a first distance value according to the color value of the two-dimensional vertex coordinate in the first distance field map; A second distance value is obtained by calculating the distance between the observation position of the rendering camera and the three-dimensional vertex of the three-dimensional model; The two-dimensional vertex coordinates that are not visible to the rendering camera are filtered from the two-dimensional vertex coordinates according to the first distance value and the second distance value.

5. The method according to claim 1, characterized in that The step of fusing the first distance field map with the second distance field map to obtain a target distance field map comprises: When the third distance value is less than the fourth distance value, the distance value of the two-dimensional vertex coordinate in the target color map is set to the third distance value.

6. A texture map generation device for a three-dimensional model, characterized in that: The device comprises: An acquisition module, used to acquire a panoramic image of a target scene and a three-dimensional model of the target scene, a first distance field map of the target scene, and a first color map of the target scene; A coordinate conversion module, used for converting the three-dimensional vertex coordinates of the three-dimensional model into two-dimensional vertex coordinates according to a coordinate conversion matrix; A generating module, configured to read color information associated with the two-dimensional vertex coordinates from the panoramic image according to the two-dimensional vertex coordinates and generate a second color map; A reading module, configured to read distance field information associated with the two-dimensional vertex coordinates from the panoramic image according to the two-dimensional vertex coordinates and generate a second distance field map; A first fusion module, used for fusing the second color map with the first color map to obtain a target color map; A second fusion module, configured to fuse the first distance field map with the second distance field map to obtain a target distance field map; And, the step of fusing the second color map with the first color map to obtain a target color map comprises: Calculate the color value of the two-dimensional vertex coordinate in the first color map and use it as the first color value; Calculate the color value of the two-dimensional vertex coordinate in the second color map and use it as the second color value; Calculate the distance value of the two-dimensional vertex coordinate in the first color map and use it as the third distance value; Calculate the distance value of the two-dimensional vertex coordinate in the second color map and use it as a fourth distance value; When the third distance value is less than the fourth distance value, the color value of the two-dimensional vertex coordinate in the target color map is set to the first color value.

7. The device according to claim 6, characterized in that The coordinate conversion module comprises: A first conversion submodule, used for converting the three-dimensional vertex coordinates of the three-dimensional model into the coordinates of the rendering camera coordinate system according to the coordinate conversion matrix; The second conversion submodule is used to convert the coordinates of the rendering camera coordinate system into the two-dimensional vertex coordinates.

8. A texture map generation device for a three-dimensional model, characterized in that: The device comprises: A memory storing executable program code; a processor coupled to the memory; The processor calls the executable program code stored in the memory to execute the texture map generation method for a three-dimensional model as described in any one of claims 1-5.

9. A storage medium, characterized in that: The storage medium stores computer instructions, which, when called, are used to execute the texture map generation method for a three-dimensional model as described in any one of claims 1-5.