Interactive three-dimensional model texture editing method, system and electronic device
By rendering the 3D model into a 2D image and performing local image modifications, the complexity of 3D model texture editing is solved and simple and intuitive texture editing is achieved.
Patent Information
- Application Number
- CN202410810154.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2024-06-21
- Publication Date
- 2024-08-30
- Estimated Expiration
- 2044-06-21
AI Technical Summary
Texture editing of 3D models in the existing technology is difficult to be intuitive and simple, especially due to the complexity of operations caused by texture stretching and fragmentation.
By rendering the 3D model into a 2D image, select the patch area to be processed, calculate the transformation relationship in the rendering scene, intercept the local image for pixel modification, and map the modified value to the original texture map of the 3D model.
It realizes the intuitiveness and simplicity of texture editing of 3D models, allowing practitioners to complete texture editing without in-depth understanding of 3D model logic. The operation is simple and intuitive.
Smart Images

Figure CN118379470B
Abstract
Description
Technical Field
[0001] The present invention relates to the field of image data processing, and more specifically, to an interactive three-dimensional model texture editing method, system and electronic equipment. Background Art
[0002] With the development of science and technology, 3D models have broad application prospects in various fields. In the field of computer graphics, the texture display of 3D models is usually completed by reading the original texture image of the model, the 3D vertices and their texture coordinates, and then mapping the pixels in the texture image to each face of the model according to the texture coordinates. Since the polygons formed by the vertex coordinates of the face and the polygons of the texture coordinates are not necessarily consistent in shape, texture stretching will occur during the mapping process.
[0003] In order to reduce the texture stretching phenomenon caused by shape inconsistency, the original texture map of the three-dimensional model is generally generated according to the following steps: first, all the faces of the model are divided and clustered according to the geometric relationship, and then small textures are generated for the sets of multiple clustered faces respectively, and many fragmented textures are merged into a large texture map.
[0004] For the 3D model texture generated by the above technology, if one wants to adjust the texture of a certain area on the 3D model, the editing can be completed by only performing pixel operations on the original texture image, which is difficult and unintuitive for practitioners. Summary of the invention
[0005] In view of the technical problems existing in the prior art, the present invention provides an interactive three-dimensional model texture editing method, system and electronic device. After the three-dimensional model is rendered to a display terminal, the rendering result is presented as a two-dimensional image. It is only necessary to cut out the area corresponding to the face patch of the texture to be processed on the three-dimensional model from the two-dimensional image, and then modify the texture of the cut-out local image, so as to edit the original texture of the face patch of the texture to be processed on the three-dimensional model.
[0006] According to a first aspect of the present invention, there is provided an interactive 3D model texture editing method, comprising the following steps:
[0007] Rendering the three-dimensional model onto the two-dimensional image, selecting the area on the two-dimensional image corresponding to the face piece to be processed on the three-dimensional model, and cutting out a local image on the two-dimensional image according to the area;
[0008] When rendering a two-dimensional image, the transformation relationship between the three-dimensional space points in the rendered scene, the pixels on the local image, and the pixels on the original texture image is calculated;
[0009] Get the depth of each pixel on the local image and find the visible part of the 3D model corresponding to the local image.
[0010] The pixels of the two-dimensional local image are modified, and the modified values of the pixels in the local image are mapped to the original texture map of the visible part of the face to be processed in the three-dimensional model.
[0011] Based on the above technical solution, the present invention can also make the following improvements.
[0012] Optionally, the calculation of the transformation relationship among the three-dimensional space point in the rendering scene, the pixel point on the local image, and the pixel point on the original texture image includes:
[0013] The transformation between the coordinates of a point in three-dimensional space and the coordinates of the pixel in the local image and the transformation between the coordinates of the pixel in the original texture image and the coordinates of the point in three-dimensional space.
[0014] Optionally, the transformation relationship between the three-dimensional space point coordinates and the pixel point coordinates on the local image includes:
[0015] Model transformation, converting the rotation, scaling and translation transformation matrix of the 3D model in the local coordinate system of the model space to the coordinate system in the world space;
[0016] View transformation: Based on the position and orientation of the camera, the view coordinate system is constructed with the camera as the origin, and the model coordinates in the world space are converted to the view space;
[0017] Projection transformation uses the perspective projection of the viewing cone to convert the three-dimensional coordinates of the view space into the two-dimensional image coordinate space.
[0018] Optionally, the transformation relationship between the pixel point coordinates in the original texture image and the three-dimensional space point coordinates includes:
[0019] The three-dimensional space vertex coordinates of each facet correspond to the UV coordinates on its original texture map. The spatial coordinates of each pixel point in the UV polygon of the original texture map are calculated by interpolating the three-dimensional space vertex coordinates of the polygon. The interpolation process adopts the perspective correction interpolation method.
[0020] Optionally, each pixel on the local image can obtain the rendered depth, corresponding to the visible part of the surface to be processed; when editing the original texture of the surface to be processed, it is necessary to use the depth value of the local image to make a visibility judgment, and only modify the original texture of the visible part.
[0021] Optionally, the modifying the pixels of the two-dimensional local image includes:
[0022] The local image is opened through an image editing program, and pixels of the local image are modified and saved according to the preset changes to the original texture of the three-dimensional model.
[0023] Optionally, mapping the modified values of the pixels in the local image to the original texture map of the visible portion of the face to be processed in the three-dimensional model includes:
[0024] According to the transformation relationship between the original texture map and the three-dimensional space point, each pixel of the patch in the polygonal area of the original texture map is traversed, and the three-dimensional space point corresponding to the pixel point coordinate is obtained through interpolation operation;
[0025] Based on the transformation relationship between the three-dimensional space point and the local image, the texture coordinates on the local image are obtained through model transformation, view transformation and perspective projection transformation;
[0026] Determine whether the pixel in the current patch is visible based on the rendering depth. If it is not visible, do not process it. If it is visible, set the modified pixel value of the two-dimensional local image to the current pixel of the original texture map.
[0027] Optionally, rendering the three-dimensional model onto the two-dimensional image and selecting the area on the two-dimensional image corresponding to the face piece to be processed on the three-dimensional model includes:
[0028] Read the three-dimensional vertex coordinates of each face in the three-dimensional model file, the texture coordinates corresponding to each vertex, and the original texture map corresponding to the model;
[0029] Based on vertex coordinates, texture maps and texture coordinates, the 3D model is loaded into the scene and displayed on the display terminal through GPU rendering technology. The display result is a 2D image.
[0030] The display terminal is operated to observe the surface to be processed and then the target area is cut out from the two-dimensional view.
[0031] According to a second aspect of the present invention, there is provided an interactive 3D model texture editing system for use in the above-mentioned interactive 3D model texture editing method, the system comprising:
[0032] A rendering module is used to display the three-dimensional model in a two-dimensional window view, and operate the window to adjust it so that the surface to be processed can be observed, and then determine the target area from the two-dimensional view and cut out a local image;
[0033] The editing module is used for pixel-level operations on two-dimensional local images, and operators can modify them as needed;
[0034] The mapping module is used to apply the pixel modification of the local image to the original texture map of the three-dimensional model to complete the texture editing of the three-dimensional model.
[0035] According to a third aspect of the present invention, there is provided an electronic device, comprising a human-computer interaction input device, a display terminal, a memory, a processor, and a texture mapping computer program P1 stored in the memory and executable on the processor, and an image editing program P2 executable on the processor; when the computer program P1 or the image editing program P2 is executed by the processor, an interactive three-dimensional model texture editing method as described above is implemented.
[0036] Technical effects and advantages of the present invention:
[0037] The present invention proposes an interactive 3D model texture editing method, system and electronic device. After the 3D model is rendered to a display terminal, the rendering result is presented as a 2D image. It is only necessary to cut out the area corresponding to the face of the texture to be processed on the 3D model from the 2D image, and then modify the texture of the cut-out local image to edit the original texture of the face of the texture to be processed on the 3D model. This allows practitioners to edit the original texture of the 3D model by modifying the 2D image without having to deeply understand the display logic of the 3D model. The operation is simple and intuitive.
[0038] Other features and advantages of the present invention will be described in the following description, and partly become apparent from the description, or understood by practicing the present invention. The purpose and other advantages of the present invention can be realized and obtained by the structures pointed out in the description, claims and drawings. BRIEF DESCRIPTION OF THE DRAWINGS
[0039] Figure 1 A flow chart of an interactive 3D model texture editing method provided by an embodiment of the present invention;
[0040] Figure 2 A schematic diagram of the original texture and the area of the facets to be processed in the three-dimensional model provided by the embodiment of the present invention; wherein: Figure 2 (a) is the original texture image rendered from the 3D model onto the 2D image. Figure 2 (b) is a regional diagram of the face to be processed in the three-dimensional model;
[0041] Figure 3 A schematic diagram of the correspondence relationship between vertex coordinates in three-dimensional space provided by an embodiment of the present invention. DETAILED DESCRIPTION
[0042] The following will be combined with the drawings in the embodiments of the present invention to clearly and completely describe the technical solutions in the embodiments of the present invention. Obviously, the described embodiments are only 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.
[0043] An embodiment of the present invention provides a computer device, including a human-computer interaction input device, a display terminal, a memory, a processor, a texture mapping computer program P1 stored in the memory and executable on the processor, and an image editing program P2 executable on the processor; when the computer program P1 or the image editing program P2 is executed by the processor, an interactive three-dimensional model texture editing method as described above is implemented.
[0044] In addition, the logic instructions in the above-mentioned memory can be implemented in the form of software functional units and can be stored in a computer-readable storage medium when sold or used as an independent product. Based on this 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, which is stored in a storage medium and includes several 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., which can store program code.
[0045] Based on the defects in the background technology, the embodiment of the present invention proposes an interactive 3D model texture editing method, such as Figure 1 As shown, the specific steps are as follows:
[0046] Step 1: Render the 3D model onto the 2D image, select the area on the 2D image corresponding to the face to be processed on the 3D model, and cut out a local image on the 2D image according to the area;
[0047] In this embodiment, the original texture image of the 3D model rendered onto the 2D image is shown in FIG. Figure 2 As shown in (a) in the figure, the area of the face to be processed in the three-dimensional model is shown in Figure 2 As shown in (b) of the figure, the textures of multiple facets are discontinuous and fragmented, which is difficult to achieve by directly editing the original texture map. The embodiment of the present invention calculates the area occupied by the facet to be processed in the original texture map, as shown in the area shown in 2 (a) of the figure, Figure 2 After modifying (b) in the figure, the modified texture can be mapped to the area occupied by the original texture map.
[0048] In the above technical solution, the rendering of the three-dimensional model onto the two-dimensional image and selecting the area on the two-dimensional image corresponding to the face to be processed on the three-dimensional model comprises:
[0049] First, the texture mapping computer program P1 reads the three-dimensional vertex coordinates of each face in the three-dimensional model file, the texture coordinates corresponding to each vertex, and the original texture map corresponding to the model;
[0050] Based on vertex coordinates, texture maps and texture coordinates, the three-dimensional model is loaded into the scene and displayed on the display terminal through GPU rendering technology. The display result is a two-dimensional image.
[0051] The extracting a local image on the two-dimensional image according to the area comprises:
[0052] According to the position of the patch of the texture to be processed in the 3D model in the rendering scene, use the camera manipulator to translate or rotate the camera in the rendering scene, and set the camera to the perspective of facing the target patch;
[0053] Based on the current camera viewing angle, through human-computer interaction, the area corresponding to the patch of the texture to be processed on the model can be selected on the displayed two-dimensional image, and the local image of the area to be processed can be cut out.
[0054] Step 2: When rendering a two-dimensional image, calculate the transformation relationship between the three-dimensional space points in the rendered scene, the pixel points on the local image, and the pixel points on the original texture image;
[0055] The transformation relationship between the three-dimensional space point in the rendering scene, the pixel point on the local image, and the pixel point on the original texture image includes: the transformation between the coordinates of the three-dimensional space point to the pixel coordinates on the local image and the transformation between the coordinates of the pixel point in the original texture image to the coordinates of the point in the three-dimensional space. Specifically,
[0056] 1) The transformation relationship between the coordinates of a point in three-dimensional space and the pixel coordinates on the local image:
[0057] If the three-dimensional vertex coordinates of any visible face in the scene are A t (x t , y t , z t ), the vertex coordinates correspond to the pixel coordinates of a point on the local image as T t (u t , v t ), then the calculation method from the vertex coordinates of the patch to the pixel coordinates on the two-dimensional image is:
[0058]
[0059] Among them, M 1 is the model matrix, M 2 is the view matrix, M 3 is the perspective projection matrix.
[0060] The transformation relationship between the coordinates of the three-dimensional space point and the coordinates of the pixel point on the local image adopts the process of model transformation to view transformation and finally to projection transformation. Specifically, it includes:
[0061] Model transformation, converting the rotation, scaling and translation transformation matrix of the 3D model in the local coordinate system of the model space to the coordinate system in the world space;
[0062] View transformation: Based on the current camera position and orientation, the view coordinate system is constructed with the camera as the origin, and the model coordinates in the world space are converted to the view space.
[0063] In the final projection transformation, the perspective projection of the viewing cone is selected to convert the three-dimensional coordinates of the view space into the two-dimensional image coordinate space.
[0064] 2) The transformation relationship between the pixel coordinates in the original texture image and the point coordinates in the three-dimensional space;
[0065] In the above technical solution, each three-dimensional space vertex of the patch polygon will have a corresponding uv coordinate of the original texture map. Therefore, the spatial coordinates of each pixel point in the uv polygon in the original texture map can be calculated by interpolating the three-dimensional space vertex coordinates of the polygon, and the interpolation process adopts the perspective correction interpolation method.
[0066] In computer graphics, faces are rendered by triangles, and the specific examples of the present invention are described based on this.
[0067] The texture coordinates of the vertices of any triangle patch on the original texture map are A' (u 0 , v 0 )、B' (u 1 , v 1 )、C'(u 2 , v 2 ), and the corresponding three-dimensional space vertex coordinates are A(x 0 , y 0 , z 0 )、B (x 1 , y 1 , z 1 )、C (x 2 , y 2 ,z 2 ). With O as the origin of the observation coordinate system, the vertices A, B, and C of the triangle are perspectively projected to A', B', and C' on the original texture map. The straight line from the origin O to any point P' in the triangle A'B'C' can intersect with the triangle ABC to obtain point P. The two points correspond one to one. See the corresponding relationship. Figure 3As shown, the specific example of the present invention calculates the spatial coordinates of P through the pixel coordinates of point P'. The pixel coordinates of any point P' in the triangular pixel area of the original texture can be calculated through the three vertices to calculate the centroid parameters , , , and so on, the three-dimensional space point P corresponding to point P' also has a centroid parameter with the vertices of the triangle space , , , as follows:
[0068]
[0069] The barycentric parameters of the original texture are known, and the relationship between the two sets of barycentric coordinates is derived through perspective correction interpolation. Then the barycentric parameters of the three-dimensional space point are calculated, and finally the parameters are substituted into the formula to get the spatial coordinates of point P'. The formula for perspective correction interpolation is as follows:
[0070]
[0071] The original texture triangle A'B'C' can be obtained by performing the matrix transformation M described in step 1) on the three-dimensional space triangle ABC. The vertex coordinates in the matrix transformation M are all expressed in the form of homogeneous coordinates (x, y, z, 1). The transformation equation of each vertex can be expanded as follows:
[0072]
[0073] In the perspective correction interpolation formula, wa, wb, and wc are the w components of each vertex in the above matrix transformation.
[0074] Step 3: Obtain the depth corresponding to each pixel on the local image, and find the visible part of the upper part of the 3D model corresponding to the local image;
[0075] Each pixel on the local image has a rendering depth, which represents the visible part of the face to be processed. The depth value of the local image is used to make visibility judgment, and only the original texture of the visible part is modified.
[0076] During the 3D model rendering process, the obstructed patches that are far from the camera will be cut out according to the depth values corresponding to the pixels on the local image. P Obtained through viewport transformation, the point T P The distance L from the camera center 1 , which is the depth value corresponding to the pixel.
[0077] For the original texture pixel area R corresponding to the vertex in any patch, traverse the pixel points inside the triangle area R, and through the mathematical relationship in step 2, the three-dimensional space point T corresponding to the pixel point can be obtained. C , calculate the distance L from this point to the camera center 2 Then, compare the distance value L 2 With the depth value L 1 If the size is greater than a certain threshold, it is marked as invisible, and vice versa. After traversing all the pixels, it can be counted whether the current face is a completely visible face or a partially visible face. Finally, the above judgment is performed on all the faces of the model to find the visible part of the face.
[0078] Step 4: Modify the pixels of the two-dimensional local image, and map the modified values of the pixels in the local image to the original texture map of the visible part of the face to be processed in the three-dimensional model.
[0079] The modifying of the pixels of the two-dimensional local image comprises: opening the local image through an image editing program, modifying the pixels of the local image according to the preset modification of the original texture of the three-dimensional model, and saving the modification.
[0080] The mapping of the modified values of the pixels in the local image to the original texture map of the visible part of the face to be processed in the three-dimensional model includes: establishing a mathematical relationship between the local image and the original texture map of the three-dimensional model. Specifically:
[0081] According to the transformation relationship between the original texture image and the three-dimensional space point, each pixel of the patch in the triangular area of the original texture image is traversed, and the three-dimensional space point corresponding to the pixel point coordinate is obtained through perspective correction interpolation operation;
[0082] Based on the transformation relationship between the three-dimensional space point and the local image, the texture coordinates on the local image are obtained through model transformation, view transformation and perspective projection transformation;
[0083] Finally, the pixel is determined to be visible in the current patch according to the rendering depth of the pixel. If visible, it is modified. According to the above relationship, the pixel of the local image is modified, and the modified value of the pixel in the local image can be mapped to the original texture map of the visible part of the patch to be processed in the 3D model.
[0084] In another embodiment, after modifying the pixels of the local image according to the mathematical relationship between the original texture map of the three-dimensional model and the local image in step 2, the modified values of the pixels in the local image can be mapped to the original texture map of the visible part of the face to be processed in the three-dimensional model. After the modified local image is opened through the texture mapping computer program P1, based on the visible face found in step 3, the following operations are performed on all visible faces:
[0085] Specifically, traverse each pixel point of the patch in the triangular pixel area of the original texture image, and first calculate the three-dimensional space point coordinates corresponding to the pixel point coordinates according to the transformation relationship described in step 2) of step 2;
[0086] Based on the transformation relationship in step 1) of step 2, the three-dimensional space coordinates are transformed by model transformation, view transformation and perspective projection transformation to obtain texture coordinates O on the local image;
[0087] Finally, according to the process described in step 3, determine whether the pixel point in the current patch is visible. If the point is not visible, skip the pixel point; if it is visible, calculate the pixel value at the texture coordinate O on the local image, and set the pixel value to the pixel point of the original texture image. Perform the above operations on all the pixels in the triangle area, and the texture modification task of a patch is completed.
[0088] The texture coordinate O is a non-integer, and its pixel value needs to be calculated by an interpolation method. The non-integer image interpolation method can be explained as follows: when the pixel coordinate is not an integer, it is necessary to round down and round down from the row and column dimensions respectively, and take the pixel points of these four integer coordinate values for a certain interpolation operation to obtain the pixel value of the non-integer position.
[0089] After all the patches are textured, an interactive 3D texture editing method is implemented. The method only needs to cut out the area corresponding to the patch of the texture to be processed on the 3D model from the 2D image, and then modify the texture of the cut-out local image, so that the original texture of the patch of the texture to be processed on the 3D model can be edited.
[0090] In addition, an embodiment of the present invention provides an interactive 3D model texture editing system for the above method, the system comprising:
[0091] A rendering module is used to display the three-dimensional model in a two-dimensional window view, and operate the window to adjust it so that the surface to be processed can be observed, and then determine the target area from the two-dimensional view and cut out a local image;
[0092] The editing module is used for pixel-level operations on two-dimensional local images, and operators can modify them as needed;
[0093] The mapping module is used to apply the pixel modification of the local image to the original texture map of the three-dimensional model to complete the texture editing of the three-dimensional model.
[0094] It can be understood that the interactive three-dimensional model texture editing system provided by the present invention corresponds to the interactive three-dimensional model texture editing method provided by the aforementioned embodiments. The relevant technical features of an interactive three-dimensional model texture editing system can refer to the relevant technical features of an interactive three-dimensional model texture editing method, which will not be repeated here.
[0095] In summary, the embodiments of the present invention propose an interactive 3D model texture editing method, system and electronic device, which are intended to solve the problem that when editing the original texture of a 3D model, the texture is difficult to modify due to the fragmentation of the original texture. After the 3D model is rendered to the display terminal, the rendering result is presented as a two-dimensional image. It is only necessary to cut out the area corresponding to the patch of the texture to be processed on the 3D model from the two-dimensional image, and then modify the texture of the cut-out local image to edit the original texture of the patch of the texture to be processed on the 3D model. This makes it possible for practitioners to edit the original texture map of the 3D model without having to deeply understand the display logic of the 3D model. They can complete the editing of the original texture map of the 3D model by simply modifying the two-dimensional image. The operation is simple and intuitive.
[0096] Although the preferred embodiments of the present invention have been described, those skilled in the art may make other changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention.
[0097] Obviously, those skilled in the art can make various changes and modifications to the present invention without departing from the spirit and scope of the present invention. Thus, if these modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include these modifications and variations.
[0098] Finally, it should be noted that the above is only a preferred embodiment of the present invention and is not intended to limit the present invention. Although the present invention has been described in detail with reference to the aforementioned embodiments, it is still possible for those skilled in the art to modify the technical solutions described in the aforementioned embodiments or to make equivalent substitutions for some of the technical features therein. Any modifications, equivalent substitutions, improvements, etc. made within the spirit and principles of the present invention should be included in the protection scope of the present invention.
Claims
1. An interactive 3D model texture editing method, characterized in that: The method comprises the following steps: Rendering the three-dimensional model onto the two-dimensional image, selecting the area on the two-dimensional image corresponding to the face piece to be processed on the three-dimensional model, and cutting out a local image on the two-dimensional image according to the area; When rendering a two-dimensional image, calculating the transformation relationship between the three-dimensional space point in the rendering scene, the pixel point on the local image, and the pixel point on the original texture image; Obtaining the depth corresponding to each pixel point on the local image, and finding the visible part of the top sheet of the three-dimensional model corresponding to the local image; Modifying the pixels of the two-dimensional local image, and mapping the modified values of the pixels in the local image to the original texture map of the visible part of the face to be processed in the three-dimensional model through the mathematical relationship between the local image and the original texture map of the three-dimensional model, including: traversing each pixel of the face in the polygonal area of the original texture map according to the transformation relationship between the original texture map and the three-dimensional space point, and obtaining the three-dimensional space point corresponding to the coordinates of the pixel point through interpolation operation; Based on the transformation relationship between the three-dimensional space point and the local image, the texture coordinates on the local image are obtained through model transformation, view transformation and perspective projection transformation; Determine whether the pixel in the current patch is visible based on the rendering depth. If it is not visible, do not process it. If it is visible, set the modified pixel value of the two-dimensional local image to the current pixel of the original texture map.
2. The interactive 3D model texture editing method according to claim 1, characterized in that: The transformation relationship between the three-dimensional space points in the computing rendering scene, the pixel points on the local image and the pixel points on the original texture image includes: The transformation between the coordinates of a point in three-dimensional space and the coordinates of a pixel on a local image and the transformation between the coordinates of a pixel on the original texture map and the coordinates of a point in three-dimensional space.
3. The interactive 3D model texture editing method according to claim 2, characterized in that: The transformation relationship between the coordinates of the three-dimensional space point and the coordinates of the pixel point on the local image includes: Model transformation, converting the rotation, scaling and translation transformation matrix of the 3D model in the local coordinate system of the model space to the coordinate system in the world space; View transformation: Based on the position and orientation of the camera, the view coordinate system is constructed with the camera as the origin, and the coordinates of the 3D model in the world space are converted to the view space; Projection transformation uses the perspective projection of the viewing cone to convert the three-dimensional coordinates of the view space into the two-dimensional image coordinate space.
4. The interactive 3D model texture editing method according to claim 2, characterized in that: The transformation relationship between the pixel point coordinates on the original texture image and the three-dimensional space point coordinates includes: Each three-dimensional space vertex of the patch polygon will have a corresponding uv coordinate of the original texture map. The spatial coordinates of each pixel point in the uv polygon area of the original texture map are calculated by interpolating the three-dimensional space vertex coordinates of the polygon. The interpolation process adopts the perspective correction interpolation method.
5. The interactive 3D model texture editing method according to claim 1, characterized in that: Each pixel point on the local image can obtain the rendering depth, which corresponds to the visible part of the surface to be processed; when editing the original texture of the surface to be processed, it is necessary to use the depth value of the local image to make visibility judgments, and only the original texture of the visible part of the surface needs to be modified.
6. The interactive 3D model texture editing method according to claim 1, characterized in that: The modifying of the two-dimensional local image pixels comprises: The local image is opened through an image editing program, and pixels of the local image are modified and saved according to the preset changes to the original texture of the three-dimensional model.
7. The interactive 3D model texture editing method according to claim 1, characterized in that: The rendering of the three-dimensional model onto the two-dimensional image and selecting the area on the two-dimensional image corresponding to the face piece to be processed on the three-dimensional model comprises: Read the three-dimensional vertex coordinates of each face in the three-dimensional model file, the texture coordinates corresponding to each vertex, and the original texture map corresponding to the model; Based on vertex coordinates, texture maps and texture coordinates, the 3D model is loaded into the scene and displayed on the display terminal through GPU rendering technology. The display result is a 2D view. The display terminal is operated to observe the surface to be processed and then the target area is cut out from the two-dimensional view.
8. An interactive 3D model texture editing system, used for the interactive 3D model texture editing method according to any one of claims 1 to 7, characterized in that: include: A rendering module is used to display the three-dimensional model in a two-dimensional window view, and operate the window to adjust it so that the surface to be processed can be observed, and then determine the target area from the two-dimensional view and cut out a local image; The editing module is used for pixel-level operations on two-dimensional local images, and operators can make manual modifications as needed; A mapping module is used to apply the pixel modification of the local image to the original texture map of the 3D model to complete the texture editing of the 3D model, including: according to the transformation relationship between the original texture map and the 3D space point, traverse each pixel of the face in the polygonal area of the original texture map, and obtain the 3D space point corresponding to the pixel point coordinate through interpolation operation; Based on the transformation relationship between the three-dimensional space point and the local image, the texture coordinates on the local image are obtained through model transformation, view transformation and perspective projection transformation; Determine whether the pixel in the current patch is visible based on the rendering depth. If it is not visible, do not process it. If it is visible, set the modified pixel value of the two-dimensional local image to the current pixel of the original texture map.
9. An electronic device, characterized in that: It includes a human-computer interaction input device, a display terminal, a memory, a processor, a texture mapping computer program P1 stored in the memory and executable on the processor, and an image editing program P2 executable on the processor; when the computer program P1 or the image editing program P2 is executed by the processor, an interactive three-dimensional model texture editing method as described in any one of claims 1 to 7 is implemented.
