Three-dimensional texture mapping method and device and computer readable storage medium
A three-dimensional texture and mapping technology, applied in the field of 3D printing, can solve the problems of high memory consumption, large amount of three-dimensional mesh data, and affecting the stability of image processing software.
Pending Publication Date: 2020-07-07
SHANGHAI UNION TECH
0 Cites 4 Cited by
AI-Extracted Technical Summary
Problems solved by technology
[0003] At present, when performing image processing on 3D texture maps, the generated 3D grid data is ve...
Abstract
The invention discloses a three-dimensional texture mapping method and device and a computer readable storage medium, and the method comprises: obtaining a to-be-mapped region of a to-be-printed three-dimensional model; unfolding a three-dimensional grid corresponding to the to-be-mapped area, and establishing a two-dimensional grid corresponding to the three-dimensional grid; adding a preset texture picture to the two-dimensional grid to obtain a corresponding two-dimensional texture grid, and obtaining a three-dimensional texture grid corresponding to the two-dimensional texture grid according to the two-dimensional texture grid; and slicing the three-dimensional texture grids to obtain sliced three-dimensional texture grids, wherein the step of obtaining the slice data comprises the sub-steps of calculating the slice layer number of the to-be-mapped area, calculating the contour line of each layer of slice layer by layer to obtain the slice data, wherein when the contour line of thecurrent layer of slice is calculated, the grid data related to the current layer of slice topology is reserved, and the grid data unrelated to the current layer of slice topology is cleared. By adopting the scheme, the storage space occupied in the three-dimensional texture mapping process can be reduced.
Application Domain
Image data processing
Technology Topic
Computer visionSlicing +3
Image
Examples
- Experimental program(1)
Example Embodiment
[0026] As mentioned above, at present, when performing image processing on a 3D texture map, the generated 3D mesh data volume is large, resulting in large memory consumption and affecting stability.
[0027] In the embodiment of the present invention, the 3D grid of the to-be-mapped area of the 3D model to be printed is expanded to obtain a 2D grid, and a preset texture picture is added to the 2D grid to obtain a corresponding 2D texture grid. Slice the 3D texture grid corresponding to the 2D texture grid to obtain the slice data. When calculating the contour lines of each slice layer by layer to obtain the slice data, keep the grid data related to the slice topology of the current layer, and clear the grid data related to the slice topology. Describes grid data that is not relevant to the slice topology of the current layer. Therefore, the storage space occupied by the grid data is also less, thereby reducing the storage space occupied in the process of three-dimensional texture mapping.
[0028] In order to make the above objects, features and beneficial effects of the embodiments of the present invention more comprehensible, specific embodiments of the present invention will be described in detail below in conjunction with the accompanying drawings.
[0029] refer to figure 1 , a flow chart of a three-dimensional texture mapping method in an embodiment of the present invention is given. The three-dimensional texture mapping method may include the following steps.
[0030] Step 11, obtaining the region to be mapped of the 3D model to be printed.
[0031] In the specific implementation, some workpieces are provided with textures, such as carvings, bites on the soles, patterns on some handicrafts, etc. Before 3D printing, the above pattern needs to be pasted on the corresponding area of the 3D model, and the area to be pasted is the area to be pasted.
[0032] Mark the area to be mapped in the 3D model to be printed, so as to facilitate the subsequent 3D texture mapping of the area to be mapped.
[0033] In a specific implementation, various marking methods may be used to mark the region to be mapped. For example, use point markers, box markers, or polygons to mark triangular patches in the area to be mapped.
[0034] Step 12, expand the 3D grid corresponding to the region to be mapped, and establish a 2D grid corresponding to the 3D grid.
[0035] In a specific implementation, after the area to be mapped is acquired, the 3D grid corresponding to the area to be mapped is expanded to obtain a 2D grid corresponding to the 3D grid.
[0036] When unfolding the 3D grid, the points in the 3D grid are mapped one by one to obtain the 2D grid.
[0037] In practical applications, not all areas to be mapped are expandable. In order to make the area to be mapped expandable, in the embodiment of the present invention, before the area to be mapped is expanded, the expandable area of the area to be mapped is expanded. Sex is tested. When it is detected that the area to be mapped cannot be expanded, the area to be mapped is divided, or remarked or remapped. Optimize the marking method by re-marking, or re-divide the texture multiple times, so that the processed area to be textured can be expanded.
[0038] Step 13, adding a preset texture picture on the two-dimensional grid to obtain a corresponding two-dimensional texture grid, and obtaining a three-dimensional texture network corresponding to the two-dimensional texture grid according to the two-dimensional texture grid grid.
[0039] In a specific implementation, after the two-dimensional grid corresponding to the area to be mapped is obtained by unfolding, the preset texture picture is added to the two-dimensional grid to obtain a corresponding two-dimensional texture grid.
[0040]The two-dimensional grid corresponds to the three-dimensional grid. When adding a texture picture to the two-dimensional grid to obtain a two-dimensional texture grid, the texture picture is also automatically added to the three-dimensional grid synchronously to obtain the two-dimensional grid. The texture mesh corresponds to the 3D texture mesh.
[0041] In a specific implementation, texture editing may be performed on the texture of the two-dimensional texture grid. When texture editing is performed on the texture of the two-dimensional texture grid, the texture of the three-dimensional texture grid also automatically responds synchronously to perform texture editing.
[0042] In a specific implementation, at least one of the following edits may be performed on the texture on the three-dimensional texture grid: translation of the texture on the three-dimensional texture grid, scaling of the texture on the three-dimensional texture grid, The texture on the three-dimensional texture grid is rotated, the boundary of the texture on the three-dimensional texture grid is processed, the texture on the three-dimensional texture grid is denoised, and the texture on the three-dimensional texture grid is Textures are multivalued, etc. When processing the texture on the three-dimensional texture grid, it is usually based on preset control parameters, and the control parameters can be preset. The control parameters may be the fineness of the 3D texture, whether the grid needs to be simplified, the slicing mode and the generation form, etc. Grid simplification can reduce unnecessary grids without sacrificing accuracy, so as to save the occupied storage space, that is, reduce the occupied memory. Slicing mode means that no 3D grid is generated, and the parallax map is used for rendering. The generation form controls the stretching distance of the texture image according to the color information, for example, white is stretched inward, and black is stretched outward. Boundary processing is used to remove incomplete stretching on region boundaries when adding texture images.
[0043] In an embodiment of the present invention, parallax mapping is performed on the three-dimensional texture grid mapping area to obtain a parallax mapping grid.
[0044] Step 14, slice the 3D texture grid to obtain slice data.
[0045] In a specific implementation, the number of slice layers of the area to be mapped is calculated, and the contour lines of slices of each layer are calculated layer by layer to obtain the slice data. The grid data related to the slice topology is used to clear the grid data not related to the slice topology of the current layer.
[0046] In one embodiment of the present invention, when calculating the slice data of each layer, discretely sample the triangles of the current layer slice, re-triangulate, calculate the texture value of each point, and calculate according to the stretching direction and distance set Stretch the vector of each point to get the local stretched grid data, move the coordinates of the corresponding point to get the stretched grid, and clear the grid data that is not related to the slice topology of the current layer.
[0047] It can be known from the above scheme that the 2D grid is obtained by expanding the 3D grid of the area to be mapped in the 3D model to be printed, and the corresponding 2D texture grid is obtained by adding a preset texture picture on the 2D grid. Slice the 3D texture grid corresponding to the 2D texture grid to obtain the slice data. When calculating the contour lines of each slice layer by layer to obtain the slice data, keep the grid data related to the slice topology of the current layer, and clear the grid data related to the slice topology. Describes grid data that is not relevant to the slice topology of the current layer.
[0048] In the prior art, in order to reflect the details of the texture, the number of generated mesh triangles is very large, and millions of levels are relatively common, which consumes a lot of memory and computing time. However, the three-dimensional triangle provided in the embodiment of the present invention Because the mapping method does not need to generate a large number of 3D grids, and deletes some 3D grid data irrelevant to the underlying slice during the slicing process, the 3D texture mapping process is faster and takes up less storage space, and it is not easy to lose textures. Map and slice large-scale textures to provide the basis for printing.
[0049] After the 3D grid in the area to be mapped is expanded, in order to speed up the calculation or save storage space, the 3D effect can be displayed without generating 3D grid data. In order to make it easier for users to browse and see the 3D effect more intuitively, And take up less storage space. In the embodiment of the present invention, after the three-dimensional texture grid is obtained, the parallax mapping process is performed on the three-dimensional texture grid to obtain the parallax mapping grid.
[0050] The three-dimensional concave-convex effect is realized visually by applying parallax map processing to the textured area, and the obtained grid is recorded as a parallax map grid. Since there is no need to generate a large number of 3D meshes, a lot of memory and computing time can be saved. In addition, during the parallax mapping process of the 3D texture grid, the boundary traces and dislocations generated when the texture picture is tiled are corrected, and the texture picture is merged to replace the original picture for mapping when the texture picture is tiled, so that the The visual effect produced by the three-dimensional texture grid is improved, so that the three-dimensional effect can be approximated by the parallax map processing, and the occupied storage space can be reduced.
[0051] It is necessary to calculate the contour line for the parallax map grid layer by layer, and also calculate the contour line for the textured part of the grid separately, and combine these contour lines to obtain the slice data. Among them, the divide-and-conquer idea is adopted when calculating the contour line of the slice: each time a specified thickness is calculated, the relevant triangles are calculated and sampled in advance, the grid is re-divided, and the local stretched network is obtained by stretching according to the texture depth value obtained by sampling Grid data, clear the previous thickness corresponding grid data that is no longer needed. In this way, the occupied storage space is small, and the stability of the processing software is improved.
[0052] In the specific implementation, when the number of triangles in the three-dimensional texture grid is small, the method of discretizing the map area, re-triangulating, and calculating the texture value of each point can be used to calculate the texture value of each point according to the set stretching direction and distance. The stretching vector of a point moves the coordinates of some points to achieve a three-dimensional concave-convex effect.
[0053] In order to facilitate those skilled in the art to better understand and implement the embodiments of the present invention, the embodiments of the present invention further provide a three-dimensional texture mapping device. refer to figure 2 , the three-dimensional texture mapping device 30 includes: an acquisition unit 31, an expansion unit 32, a mapping unit 33 and a slicing unit 34, wherein:
[0054] The acquisition unit 31 is adapted to acquire the area to be mapped of the three-dimensional model to be printed;
[0055] The unfolding unit 32 is adapted to expand the three-dimensional grid corresponding to the area to be mapped, and establish a two-dimensional grid corresponding to the three-dimensional grid;
[0056] The mapping unit 33 is adapted to add a preset texture picture on the two-dimensional grid to obtain a corresponding two-dimensional texture grid, and obtain a corresponding two-dimensional texture grid according to the two-dimensional texture grid. grid corresponding to the three-dimensional texture grid;
[0057] The slicing unit 34 is suitable for slicing the three-dimensional texture grid to obtain slicing data, and calculating the number of slicing layers of the area to be mapped, calculating the contour lines of each layer slice layer by layer, and obtaining the contour of each layer slice Line data, wherein, when calculating the contour line of the current layer slice, the grid data related to the current layer slice topology is retained, and the grid data not related to the current layer slice topology is cleared.
[0058] In a specific implementation, the slicing unit 34 is adapted to discretely sample the triangles sliced in the current layer, re-triangulate, calculate the texture value of each point, and calculate the texture value of each point according to the stretching direction and distance set. Stretch the vector to obtain local stretched grid data, move the coordinates of the corresponding points to get the stretched grid, clear the grid data irrelevant to the topology of the current layer slice, and calculate the outline of the current layer slice.
[0059] In a specific implementation, the 3D texture mapping device 30 may further include: an editing unit (not shown in the figure), which can edit the texture of the 3D texture grid after obtaining the 3D texture interface.
[0060] In a specific implementation, the editing unit is adapted to perform at least one of the following edits: translate the texture of the 3D texture grid; scale the texture of the 3D texture grid; The texture of the three-dimensional texture grid is rotated; the boundary of the texture of the three-dimensional texture grid is processed; the texture of the three-dimensional texture grid is denoised; and the texture of the three-dimensional texture grid is multivalued.
[0061] In a specific implementation, the three-dimensional texture mapping device 30 may also include: a marking unit (not shown in the figure), adapted to use any of the following methods to process the area to be mapped after obtaining the three-dimensional model to be printed Mark the target of the mapping area: point mark, box mark, polygon mark, to specify the area to be mapped in the printed 3D model.
[0062] In a specific implementation, the three-dimensional texture mapping device 30 may also include: a detection unit (not shown in the figure), adapted to detect whether the area to be mapped can be Expanding: when the area to be mapped cannot be expanded, the area to be mapped is divided and remarked so that the processed area to be mapped can be expanded.
[0063] In a specific implementation, the 3D texture mapping device 30 may also include: a parallax mapping unit (not shown in the figure), adapted to perform parallax mapping processing on the 3D texture grid after obtaining the 3D texture grid , to get the parallax map grid.
[0064] In a specific implementation, the working principle and workflow of the 3D texture mapping device 30 can refer to the description of the 3D texture mapping method in the above-mentioned embodiments of the present invention, which will not be repeated here.
[0065] The embodiment of the present invention also provides a three-dimensional texture mapping device, including a memory and a processor, the memory stores computer instructions that can run on the processor, and the processor executes the present invention when running the computer instructions The steps of the three-dimensional texture mapping method provided in any one of the above embodiments.
[0066] The embodiment of the present invention also provides a computer-readable storage medium. The computer-readable storage medium is a non-volatile storage medium or a non-transitory storage medium, and computer instructions are stored thereon. Steps of the three-dimensional texture mapping method provided by any embodiment.
[0067] Those of ordinary skill in the art can understand that all or part of the steps in the various methods of the above embodiments can be completed by instructing related hardware through a program, and the program can be stored in any computer-readable storage medium, and the storage medium can include : ROM, RAM, disk or CD, etc.
[0068] Although the present invention is disclosed above, the present invention is not limited thereto. Any person skilled in the art can make various changes and modifications without departing from the spirit and scope of the present invention, so the protection scope of the present invention should be based on the scope defined in the claims.
PUM


Description & Claims & Application Information
We can also present the details of the Description, Claims and Application information to help users get a comprehensive understanding of the technical details of the patent, such as background art, summary of invention, brief description of drawings, description of embodiments, and other original content. On the other hand, users can also determine the specific scope of protection of the technology through the list of claims; as well as understand the changes in the life cycle of the technology with the presentation of the patent timeline. Login to view more.