Three-dimensional model mapping method, device, electronic equipment and storage medium
By obtaining the vertex coordinates and width and height ratio of the three-dimensional model, determining the map area and scaling the map in an equal ratio, the problem of deformation of the three-dimensional model map due to changes in the shape of the visual surface is solved, and the user experience is improved.
Patent Information
- Application Number
- CN202210402617.0
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-04-18
- Publication Date
- 2025-02-25
- Estimated Expiration
- 2042-04-18
AI Technical Summary
During the shooting process, the visual surface of the three-dimensional model is different in shape, resulting in deformation of the map, affecting the user experience.
By obtaining multiple vertex coordinates of the visual surface of the target three-dimensional model, the width and height ratio is determined, and the map area is determined based on the width and height ratio, the preset area range of the map coordinates and the adjustment parameters. Then, scale the original map equally to get the target map and fill it into the map area.
It effectively avoids the deformation of the map due to changes in the shape of the visible surface and improves the user experience.
Smart Images

Figure CN114842118B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to image processing technology, and in particular to a three-dimensional model mapping method, device, electronic device and storage medium. Background Art
[0002] In the related art, a related 3D model can be generated according to the object photographed by the user, and a map can be applied to the visible surface of the 3D model to show a fantastic and dreamy scene. However, during the shooting process, the visible surface of the 3D model is dynamically generated according to the actual object photographed, and the different shapes of the visible surface will cause the map on the visible surface to be deformed, affecting the user experience. Summary of the invention
[0003] The present disclosure provides a 3D model mapping method, device, electronic device and storage medium to at least solve the problem of deformation of the mapping on the visible surface of the 3D model in the related art. The technical solution of the present disclosure is as follows:
[0004] According to a first aspect of an embodiment of the present disclosure, a three-dimensional model mapping method is provided, comprising:
[0005] Obtaining coordinates of multiple vertices of a visible surface of a target three-dimensional model;
[0006] Determining the aspect ratio of the visible surface according to the coordinates of the multiple vertices of the visible surface;
[0007] Determining a mapping area of the visible surface according to the aspect ratio of the visible surface, a preset area range of mapping coordinates, and an adjustment parameter for the mapping coordinates, wherein the mapping coordinates are coordinates of a plurality of vertices surrounding the mapping area, and the adjustment parameter is used to move the mapping coordinates away from an edge of the visible surface;
[0008] Scaling the length and width of the original texture according to the aspect ratio of the visible surface to obtain a target texture;
[0009] Fill the target texture into the texture area.
[0010] Optionally, the visible surface of the target three-dimensional model includes a first visible surface and a second visible surface, and the area of the first visible surface is greater than the area of the second visible surface, and determining the mapping area of the visible surface according to the aspect ratio of the visible surface, a preset area range of mapping coordinates, and an adjustment parameter for the mapping coordinates includes:
[0011] Determining a plurality of mapping coordinates of the first visible surface according to the aspect ratio of the first visible surface, a preset area range of the mapping coordinates of the first visible surface, and an adjustment parameter for the mapping coordinates of the first visible surface;
[0012] Determining a plurality of mapping coordinates of the second visible surface according to the aspect ratio of the first visible surface, the aspect ratio of the second visible surface, a preset area range of mapping coordinates of the second visible surface, and adjustment parameters for the mapping coordinates of the second visible surface;
[0013] A rectangular area enclosed by sequentially connecting the mapping vertices determined by each mapping coordinate of the first visible surface is determined as the mapping area of the first visible surface, and a rectangular area enclosed by sequentially connecting the mapping vertices determined by each mapping coordinate of the second visible surface is determined as the mapping area of the second visible surface.
[0014] Optionally, the visible surface of the target three-dimensional model includes a third visible surface, and determining the mapping area of the visible surface according to the aspect ratio of the visible surface, a preset area range of mapping coordinates, and an adjustment parameter for the mapping coordinates includes:
[0015] Determining a plurality of mapping coordinates of the third visible surface according to the aspect ratio of the third visible surface, a preset area range of the mapping coordinates of the third visible surface, and adjustment parameters for the mapping coordinates of the third visible surface;
[0016] A rectangular area enclosed by sequentially connecting the mapping vertices determined by each mapping coordinate of the third visible surface is determined as the mapping area of the third visible surface.
[0017] Optionally, the specific calculation formula for determining the multiple mapping coordinates of the first visible surface according to the aspect ratio of the first visible surface, the preset area range of the mapping coordinates of the first visible surface, and the adjustment parameters of the mapping coordinates of the first visible surface is:
[0018] The first lower left corner texture coordinates = (math.max(ratio2-A,B)×(-1)-C+math.min(A-ratio2,B)), (math.max(A-ratio 2,B)×(-1)-C);
[0019] The first lower right corner texture coordinate = A + D, (math.max (A-ratio2, B) × (-1) - C);
[0020] The first upper right corner texture coordinate = A+D, (math.min(ratio2-A,B)×(-1)+E);
[0021] The first upper left corner texture coordinates = (math.max(ratio2-A,B)×(-1)-C+math.min(A-ratio2,B)), (math.min(ratio2-A,B)×(-1)+E);
[0022] Among them, ratio2 is the aspect ratio of the first visible surface, A and B are respectively the endpoint values of the preset interval of the horizontal coordinate in the preset area range of the mapping coordinates of the first visible surface, or, A and B are respectively the endpoint values of the preset interval of the vertical coordinate in the preset area range of the mapping coordinates of the first visible surface, wherein A is greater than B, and C, D and E are adjustment parameters for the mapping coordinates of the first visible surface.
[0023] Optionally, the specific calculation formula according to the aspect ratio of the first visible surface, the aspect ratio of the second visible surface, the preset area range of the mapping coordinates of the second visible surface, and the adjustment parameters of the mapping coordinates of the second visible surface is:
[0024] The second lower left corner texture coordinate = b + d, (math.max (a-ratio3, b) × (-1) - c) × textureScale;
[0025] The second lower right corner texture coordinates = (math.min(a-ratio3,b)×(-1)+e+math.max(ratio3-a,b))×textureScale, (math.max(a-ratio3,b)×(-1)-c)×textureScale;
[0026] The second upper right corner texture coordinates = (math.min(a-ratio3,b)×(-1)+e+math.max(ratio3-a,b))×textureScale, (math.min(ratio3-a,b)×(-1)+e)×textureScale;
[0027] The second top left corner texture coordinate = b + d, (math.min(ratio3-a,b)×(-1)+e)×textureScale;
[0028] Among them, ratio3 is the aspect ratio of the second visible surface, textureScale is the smaller value of the aspect ratio of the first visible surface and the aspect ratio of the second visible surface, a and b are respectively the endpoint values of the preset interval of the horizontal coordinate in the preset area range of the mapping coordinates of the first visible surface, or, a and b are respectively the endpoint values of the preset interval of the vertical coordinate in the preset area range of the mapping coordinates of the first visible surface, wherein a is greater than b, and c, d and e are adjustment parameters for the mapping coordinates of the second visible surface.
[0029] Optionally, according to the aspect ratio of the third visible surface, the preset area range of the mapping coordinates of the third visible surface, and the adjustment parameters of the mapping coordinates of the third visible surface, a specific calculation formula for determining the multiple mapping coordinates of the third visible surface is:
[0030] The third lower left corner texture coordinates = math.max(ratio1-H,M)×(-1)-F, math.max(H-ratio1,M)×(-1)-F;
[0031] The third lower right corner texture coordinates = math.min(H-ratio1,M)×(-1)+G, math.max(H-ratio1,M)×(-1)-F;
[0032] The third upper right corner texture coordinates = math.min(H-ratio1,M)×(-1)+G, math.min(ratio1-H,M)×(-1)+G;
[0033] The third upper left corner texture coordinates = math.max(ratio1-H,M)×(-1)-F, math.min(ratio1-H,M)×(-1)+G;
[0034] Among them, ratio1 is the aspect ratio of the third visible surface, H and M are respectively the endpoint values of the preset interval of the horizontal coordinate in the preset area range of the mapping coordinates of the first visible surface, or, H and M are respectively the endpoint values of the preset interval of the vertical coordinate in the preset area range of the mapping coordinates of the first visible surface, wherein H is greater than M, and F and G are adjustment parameters for the mapping coordinates of the third visible surface.
[0035] Optionally, the target three-dimensional model has a plurality of visible surfaces, and scaling the length and width of the original texture according to the aspect ratio of the visible surfaces to obtain the target texture includes:
[0036] Determine the minimum aspect ratio of the multiple visible surfaces as a scaling parameter of the original texture;
[0037] Scaling the length and width of the original texture according to the scaling parameter to obtain the target texture;
[0038] Filling the target texture into the texture area includes:
[0039] The target texture is filled into the texture areas of the respective multiple visible surfaces of the target three-dimensional model.
[0040] Optionally, before the step of filling the target map into the map area, the method further includes:
[0041] When the aspect ratio of the visible surface is greater than a preset threshold, determining that the mapping mode of the visible surface is repeated horizontal filling, wherein the repeated horizontal filling is to fill the target mapping multiple times along the length direction of the mapping area;
[0042] Determining the number of times the target map is repeatedly filled in the length direction of the map area of the visible surface according to the length of the map area of the visible surface and the length of the target map;
[0043] The step of filling the target map into the map area includes:
[0044] According to the number of repeated filling times, the target map is repeatedly filled horizontally to the map area.
[0045] Optionally, before the step of filling the target map into the map area, the method further includes:
[0046] When the aspect ratio of the visible surface is less than a preset threshold, determining that the mapping mode of the visible surface is single horizontal filling, wherein the single horizontal filling is to fill the mapping area with the target map once;
[0047] The step of filling the target map into the map area includes:
[0048] The target map is filled horizontally to the middle of the map area.
[0049] Optionally, the visible surface of the target three-dimensional model includes a first visible surface and a second visible surface, and the area of the first visible surface is larger than that of the second visible surface. Before the step of filling the target texture into the texture area, the method further includes:
[0050] When the aspect ratio of the first visible surface and the aspect ratio of the second visible surface are both greater than a preset threshold, the mapping mode of the first visible surface is determined to be repeated horizontal filling, and the mapping mode of the second visible surface is determined to be single horizontal filling, wherein the repeated horizontal filling is to fill the target texture multiple times along the length direction of the texture area, and the single horizontal filling is to fill the target texture once in the middle of the texture area;
[0051] Determining the number of times the target map is repeatedly filled in the length direction of the map area of the first visible surface according to the length of the map area of the first visible surface and the length of the target map;
[0052] The step of filling the target map into the map area includes:
[0053] According to the number of repeated filling times, the target texture is repeatedly filled horizontally to the texture area of the first visible surface, and the target texture is single-filled horizontally to the texture area of the second visible surface.
[0054] According to a second aspect of an embodiment of the present disclosure, a three-dimensional model mapping device is provided, comprising:
[0055] An acquisition module is configured to acquire coordinates of multiple vertices of a visible surface of a target three-dimensional model;
[0056] A first determining module is configured to determine the aspect ratio of the visible surface according to the plurality of vertex coordinates of the visible surface;
[0057] A second determining module is configured to determine a mapping area of the visible surface according to the aspect ratio of the visible surface, a preset area range of mapping coordinates, and an adjustment parameter for the mapping coordinates, wherein the mapping coordinates are coordinates of a plurality of vertices that enclose the mapping area, and the adjustment parameter is used to move the mapping coordinates away from an edge of the visible surface;
[0058] A scaling module is configured to scale the length and width of the original texture according to the aspect ratio of the visible surface to obtain a target texture;
[0059] A filling module is configured to fill the target map into the map area.
[0060] Optionally, the visible surface of the target three-dimensional model includes a first visible surface and a second visible surface, and an area of the first visible surface is greater than an area of the second visible surface, and the second determining module includes:
[0061] A first determining submodule is configured to determine a plurality of mapping coordinates of the first visible surface according to the aspect ratio of the first visible surface, a preset area range of the mapping coordinates of the first visible surface, and an adjustment parameter for the mapping coordinates of the first visible surface;
[0062] A second determining submodule is configured to determine a plurality of mapping coordinates of the second visible surface according to the aspect ratio of the first visible surface, the aspect ratio of the second visible surface, a preset area range of the mapping coordinates of the second visible surface, and an adjustment parameter for the mapping coordinates of the second visible surface;
[0063] The third determination submodule is configured to determine a rectangular area enclosed by sequentially connecting the mapping vertices determined by each mapping coordinate of the first visible surface as the mapping area of the first visible surface, and to determine a rectangular area enclosed by sequentially connecting the mapping vertices determined by each mapping coordinate of the second visible surface as the mapping area of the second visible surface.
[0064] Optionally, the second determining module includes:
[0065] a fifth determining submodule, configured to determine a plurality of mapping coordinates of the third visible surface according to the aspect ratio of the third visible surface, a preset area range of the mapping coordinates of the third visible surface, and an adjustment parameter for the mapping coordinates of the third visible surface;
[0066] The sixth determining submodule is configured to determine a rectangular area enclosed by sequentially connecting the mapping vertices determined by each mapping coordinate of the third visible surface as the mapping area of the third visible surface.
[0067] Optionally, the specific calculation formula for determining the multiple mapping coordinates of the first visible surface according to the aspect ratio of the first visible surface, the preset area range of the mapping coordinates of the first visible surface, and the adjustment parameters of the mapping coordinates of the first visible surface is:
[0068] The first lower left corner texture coordinates = (math.max(ratio2-A,B)×(-1)-C+math.min(A-ratio2,B)), (math.max(A-ratio 2,B)×(-1)-C);
[0069] The first lower right corner texture coordinate = A + D, (math.max (A-ratio2, B) × (-1) - C);
[0070] The first upper right corner texture coordinate = A+D, (math.min(ratio2-A,B)×(-1)+E);
[0071] The first upper left corner texture coordinates = (math.max(ratio2-A,B)×(-1)-C+math.min(A-ratio2,B)), (math.min(ratio2-A,B)×(-1)+E);
[0072] Among them, ratio2 is the aspect ratio of the first visible surface, A and B are respectively the endpoint values of the preset interval of the horizontal coordinate in the preset area range of the mapping coordinates of the first visible surface, or, A and B are respectively the endpoint values of the preset interval of the vertical coordinate in the preset area range of the mapping coordinates of the first visible surface, wherein A is greater than B, and C, D and E are adjustment parameters for the mapping coordinates of the first visible surface.
[0073] Optionally, the specific calculation formula according to the aspect ratio of the first visible surface, the aspect ratio of the second visible surface, the preset area range of the mapping coordinates of the second visible surface, and the adjustment parameters of the mapping coordinates of the second visible surface is:
[0074] The second lower left corner texture coordinate = b + d, (math.max (a-ratio3, b) × (-1) - c) × textureScale;
[0075] The second lower right corner texture coordinates = (math.min(a-ratio3,b)×(-1)+e+math.max(ratio3-a,b))×textureScale, (math.max(a-ratio3,b)×(-
[0076] 1)-c)×textureScale;
[0077] The second upper right corner texture coordinates = (math.min(a-ratio3,b)×(-1)+e+math.max(ratio3-a,b))×textureScale, (math.min(ratio3-a,b)×(-
[0078] 1)+e)×textureScale;
[0079] The second top left corner texture coordinate = b + d, (math.min(ratio3-a,b)×(-1)+e)×textureScale;
[0080] Among them, ratio3 is the aspect ratio of the second visible surface, textureScale is the smaller value of the aspect ratio of the first visible surface and the aspect ratio of the second visible surface, a and b are respectively the endpoint values of the preset interval of the horizontal coordinate in the preset area range of the mapping coordinates of the first visible surface, or, a and b are respectively the endpoint values of the preset interval of the vertical coordinate in the preset area range of the mapping coordinates of the first visible surface, wherein a is greater than b, and c, d and e are adjustment parameters for the mapping coordinates of the second visible surface.
[0081] Optionally, according to the aspect ratio of the third visible surface, the preset area range of the mapping coordinates of the third visible surface, and the adjustment parameters of the mapping coordinates of the third visible surface, a specific calculation formula for determining the multiple mapping coordinates of the third visible surface is:
[0082] The third lower left corner texture coordinates = math.max(ratio1-H,M)×(-1)-F, math.max(H-ratio1,M)×(-1)-F;
[0083] The third lower right corner texture coordinates = math.min(H-ratio1,M)×(-1)+G, math.max(H-ratio1,M)×(-1)-F;
[0084] The third upper right corner texture coordinates = math.min(H-ratio1,M)×(-1)+G, math.min(ratio1-H,M)×(-1)+G;
[0085] The third upper left corner texture coordinates = math.max(ratio1-H,M)×(-1)-F, math.min(ratio1-H,M)×(-1)+G;
[0086] Among them, ratio1 is the aspect ratio of the third visible surface, H and M are respectively the endpoint values of the preset interval of the horizontal coordinate in the preset area range of the mapping coordinates of the first visible surface, or, H and M are respectively the endpoint values of the preset interval of the vertical coordinate in the preset area range of the mapping coordinates of the first visible surface, wherein H is greater than M, and F and G are adjustment parameters for the mapping coordinates of the third visible surface.
[0087] Optionally, the target three-dimensional model has a plurality of visible surfaces, and the scaling module comprises:
[0088] A fourth determination submodule is configured to determine the minimum aspect ratio of the multiple visible surfaces as a scaling parameter of the original texture;
[0089] A scaling submodule, configured to scale the length and width of the original texture according to the scaling parameter to obtain the target texture;
[0090] The filling module comprises:
[0091] The first filling submodule is configured to fill the target texture into the texture areas of the multiple visible surfaces of the target three-dimensional model.
[0092] Optionally, the device further comprises:
[0093] A third determining module is configured to determine that the mapping mode of the visible surface is repeated horizontal filling when the aspect ratio of the visible surface is greater than a preset threshold, wherein the repeated horizontal filling is to fill the target mapping multiple times along the length direction of the mapping area;
[0094] A fourth determining module is configured to determine the number of times the target texture is repeatedly filled in the length direction of the texture area of the visible surface according to the length of the texture area of the visible surface and the length of the target texture;
[0095] The filling module comprises:
[0096] The second filling submodule is configured to repeatedly fill the target texture into the texture area horizontally according to the number of repeated filling times.
[0097] Optionally, the device further comprises:
[0098] a fifth determining module configured to determine that the mapping mode of the visible surface is single horizontal filling when the aspect ratio of the visible surface is less than a preset threshold, wherein the single horizontal filling is to fill the mapping area with the target texture once;
[0099] The filling module comprises:
[0100] The third filling submodule is configured to fill the target map horizontally to the middle of the map area.
[0101] Optionally, the visible surface of the target three-dimensional model includes a first visible surface and a second visible surface, and the area of the first visible surface is larger than that of the second visible surface, and the device further includes:
[0102] a sixth determining module, configured to, when the aspect ratio of the first visible surface and the aspect ratio of the second visible surface are both greater than a preset threshold, determine the mapping mode of the first visible surface as repeated horizontal filling, and determine the mapping mode of the second visible surface as single horizontal filling, wherein the repeated horizontal filling is to fill the target mapping multiple times along the length direction of the mapping area, and the single horizontal filling is to fill the target mapping once in the middle of the mapping area;
[0103] a seventh determining module, configured to determine the number of times the target texture is repeatedly filled in the length direction of the texture area of the first visible surface according to the length of the texture area of the first visible surface and the length of the target texture;
[0104] The filling module comprises:
[0105] The fourth filling submodule is configured to repeatedly fill the target texture into the texture area of the first visible surface horizontally according to the number of repeated filling times, and to fill the target texture into the texture area of the second visible surface horizontally only.
[0106] According to a third aspect of an embodiment of the present disclosure, there is provided an electronic device, including:
[0107] processor;
[0108] a memory for storing instructions executable by the processor;
[0109] Wherein, the processor is configured to execute the instructions to implement the three-dimensional model mapping method as described in the first aspect.
[0110] According to a fourth aspect of an embodiment of the present disclosure, a computer-readable storage medium is provided. When instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the three-dimensional model mapping method as described in the first aspect.
[0111] According to a fifth aspect of an embodiment of the present disclosure, there is provided a computer program product, comprising a computer program, wherein when the computer program is executed by a processor, the three-dimensional model mapping method as described in the first aspect is implemented.
[0112] The technical solution provided by the embodiments of the present disclosure brings at least the following beneficial effects:
[0113] The present invention obtains multiple vertex coordinates of a visible surface of a target three-dimensional model, and then determines the aspect ratio of the visible surface according to the multiple vertex coordinates of the visible surface, and then determines the mapping area of the visible surface according to the aspect ratio of the visible surface, a preset area range of mapping coordinates, and adjustment parameters for the mapping coordinates, wherein the mapping coordinates are the coordinates of multiple vertices that form the mapping area, and the adjustment parameters are used to make the mapping coordinates away from the edge of the visible surface, and the length and width of the original mapping are scaled according to the aspect ratio of the visible surface to obtain a target mapping, and finally, the target mapping is filled into the mapping area. According to the coordinates of multiple vertices of the visible surface of the three-dimensional model, the aspect ratio of the visible surface can be determined, and then the mapping area of the visible surface can be determined through the aspect ratio, the preset area range of the mapping coordinates and the adjustment parameters for the mapping coordinates, so as to fill the target map to the appropriate position, and according to the aspect ratio of the visible surface, the original map is adjusted to adapt to the size of the visible surface, and finally, the appropriate target map can be adapted according to the shape of the visible surface of the three-dimensional model, and the target map is filled in the appropriate position. When the original map is adjusted to obtain the target map, the length and width of the original map are scaled to the same extent, so that the target map will not be deformed, so as to improve the user experience.
[0114] It is to be understood that the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0115] The drawings herein are incorporated into and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the description are used to explain the principles of the present disclosure, and do not constitute improper limitations on the present disclosure.
[0116] Figure 1 is a flow chart of a three-dimensional model mapping method according to an exemplary embodiment;
[0117] Figure 2 is a flow chart showing a method for determining a mapping area according to an exemplary embodiment;
[0118] Figure 3 is a schematic diagram of a mapping effect according to an exemplary embodiment;
[0119] Figure 4 is a block diagram of a three-dimensional model mapping device according to an exemplary embodiment;
[0120] Figure 5 It is a block diagram of an electronic device according to an exemplary embodiment. DETAILED DESCRIPTION
[0121] In order to enable ordinary persons in the art to better understand the technical solutions of the present disclosure, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below in conjunction with the accompanying drawings.
[0122] It should be noted that the terms "first", "second", etc. in the specification and claims of the present disclosure and the above-mentioned drawings are used to distinguish similar objects, and are not necessarily used to describe a specific order or sequence. It should be understood that the data used in this way can be interchanged where appropriate, so that the embodiments of the present disclosure described herein can be implemented in an order other than those illustrated or described herein. The embodiments described in the following exemplary embodiments do not represent all embodiments consistent with the present disclosure. Instead, they are merely examples of devices and methods consistent with some aspects of the present disclosure as detailed in the appended claims.
[0123] Figure 1 is a flow chart of a three-dimensional model mapping method according to an exemplary embodiment. Figure 1 As shown, the following steps are included:
[0124] In step S11, coordinates of multiple vertices of a visible surface of a target three-dimensional model are obtained.
[0125] The target three-dimensional model is a three-dimensional model corresponding to the target object generated based on the target object when the user photographs the target object. In the shooting perspective, the target three-dimensional model can show the user one or more visible surfaces. According to the coordinate system during three-dimensional modeling, multiple vertex coordinates of one or more visible surfaces of the target three-dimensional model can be obtained, and the number of vertices is determined according to the shape of the visible surface.
[0126] In step S12, the aspect ratio of the visible surface is determined according to the coordinates of a plurality of vertices of the visible surface.
[0127] In this method, a vertex coordinate pair representing the width of each display surface and a vertex coordinate pair representing the height of each display surface can be obtained from multiple vertex coordinates of the visible surface to obtain the width and height of the visible surface. Then, the ratio of the width to the height of the visible surface is determined as the aspect ratio of the visible surface.
[0128] In step S13, the mapping area of the visible surface is determined according to the aspect ratio of the visible surface, the preset area range of the mapping coordinates and the adjustment parameters for the mapping coordinates, the mapping coordinates are the coordinates of multiple vertices that surround the mapping area, and the adjustment parameters are used to make the mapping coordinates away from the edge of the visible surface.
[0129] In this embodiment, since the three-dimensional model may be an irregular model, the visible surface is also an irregular polygon, and the original map is usually a rectangle. In order to facilitate mapping on the visible surface, it is necessary to obtain a rectangular mapping area on the visible surface. The mapping area of the visible surface can be calculated using a preset calculation formula based on the aspect ratio of the visible surface, the preset area range of the mapping coordinates, and the adjustment parameters of the mapping coordinates.
[0130] Specifically, when there is only one visible surface, the method for determining the mapping area of the visible surface according to the aspect ratio of the visible surface, the preset area range of the mapping coordinates, and the adjustment parameters for the mapping coordinates is:
[0131] Determining a plurality of mapping coordinates of the third visible surface according to the aspect ratio of the third visible surface, a preset area range of the mapping coordinates of the third visible surface, and adjustment parameters for the mapping coordinates of the third visible surface;
[0132] A rectangular area enclosed by sequentially connecting the mapping vertices determined by each mapping coordinate of the third visible surface is determined as the mapping area of the third visible surface.
[0133] In the above method, firstly, according to the aspect ratio of the visible surface, the preset area range of the mapping coordinates and the adjustment parameters for the mapping coordinates, the mapping coordinates are the coordinates of the multiple vertices that surround the mapping area, so as to determine the multiple mapping vertex coordinates of the visible surface according to the preset calculation formula, and then determine the mapping area according to the multiple mapping vertex coordinates. Specifically, the mapping area can be a rectangle, and there are four mapping vertices at this time, namely the lower left vertex, the lower right vertex, the upper right vertex and the upper left vertex. The specific calculation formula of the multiple mapping vertices can be:
[0134] The third lower left corner texture coordinates (lower left corner vertex coordinates) = math.max(ratio1-H,M)×(-1)-F, math.max(H-ratio1,M)×(-1)-F;
[0135] The third lower right corner texture coordinates (lower right corner vertex coordinates) = math.min(H-ratio1,M)×(-1)+G, math.max(H-ratio1,M)×(-1)-F;
[0136] The third upper right corner texture coordinates (upper right corner vertex coordinates) = math.min(H-ratio1,M)×(-1)+G, math.min(ratio1-H,M)×(-1)+G;
[0137] The third upper left corner texture coordinates (upper left corner vertex coordinates) = math.max(ratio1-H,M)×(-1)-F, math.min(ratio1-H,M)×(-1)+G;
[0138] Among them, ratio1 is the aspect ratio of the visible surface, H and M are respectively the endpoint values of the preset interval of the horizontal coordinate in the preset area range of the mapping coordinates of the first visible surface, or, H and M are respectively the endpoint values of the preset interval of the vertical coordinate in the preset area range of the mapping coordinates of the first visible surface. Usually, the preset intervals of the horizontal coordinate and the vertical coordinate in the preset area range of the mapping coordinates of the visible surface are both 0 to 1, wherein H is greater than M, that is, the value of H can be 1, and the value of M can be 0. F and G are adjustment parameters for the mapping coordinates of the visible surface. The adjustment parameters are preset values, and their value range can be 0 to 2, which are used to adjust the mapping coordinates to be close to the center of the visible surface to avoid that when the shape of the visible surface is irregular, the mapping area obtained by multiple mapping coordinates is not completely within the visible surface. For example, the value of F can be 0.2, and the value of G can be 1.2.
[0139] In step S14, the length and width of the original texture are scaled according to the aspect ratio of the visible surface to obtain a target texture.
[0140] Due to the different shapes of the visible surface, the sizes of the final mapping areas are also different. If the original mapping is too large, directly filling the original mapping on the visible surface will cause the mapping to exceed the mapping area or the area of the visible surface. If the original mapping is too small, the mapping filling range on the visible surface will be too small, affecting the user experience. Therefore, according to the aspect ratio of the visible surface, the length and width of the original mapping can be scaled to the same extent to obtain a target mapping that is suitable for the visible surface or the mapping area. Proportional scaling can avoid deformation of the target mapping to improve the user experience.
[0141] In step S15, the target map is filled into the map area.
[0142] After obtaining a suitable mapping area on the visible surface and a target mapping that is adapted to the visible surface or mapping area, the target mapping is directly filled into the mapping area so that the size and position of the mapping are automatically adapted according to the area of the visible surface. After the target mapping is filled into the mapping area, the edge of the target mapping can be feathered so that the transition between the target mapping and the visible surface is smoother.
[0143] According to the coordinates of multiple vertices of the visible surface of the three-dimensional model, the aspect ratio of the visible surface, the preset area range of the mapping coordinates and the adjustment parameters for the mapping coordinates can be determined, and then the mapping area of the visible surface can be determined by the aspect ratio, so that the target mapping can be filled to a suitable position, and the original mapping can be adjusted according to the aspect ratio of the visible surface to adapt to the size of the visible surface. Finally, a suitable target mapping can be adapted according to the shape of the visible surface of the three-dimensional model, and the target mapping can be filled in a suitable position. When the original mapping is adjusted to obtain the target mapping, the length and width of the original mapping are scaled to the same extent, so that the target mapping will not be deformed, so as to improve the user experience.
[0144] Figure 2 is a flow chart showing a method for determining a mapping area according to an exemplary embodiment. Figure 2 As shown, based on the above technical solution, the target three-dimensional model may include multiple visible surfaces, specifically including a first visible surface and a second visible surface, and the area of the first visible surface is greater than the area of the second visible surface. In this case, the mapping areas of different visible surfaces need to be calculated separately, specifically:
[0145] In step S21, a plurality of mapping coordinates of the first visible surface are determined according to the aspect ratio of the first visible surface, a preset area range of the mapping coordinates of the first visible surface, and adjustment parameters for the mapping coordinates of the first visible surface.
[0146] When there are two visible surfaces, the multiple mapping vertices of the visible surface with a larger area (i.e., the first visible surface) are respectively the first lower left corner vertex, the first lower right corner vertex, the first upper right corner vertex, and the first upper left corner vertex. The specific calculation formula for the multiple mapping vertices of the first visible surface is:
[0147] The first lower left corner texture coordinate (the first lower left corner vertex) = (math.max(ratio2-A,B)×(-1)-C+math.min(A-ratio2,B)), (math.max(A-ratio 2,B)×(-1)-C);
[0148] The first lower right corner texture coordinate (the first lower right corner vertex) = A + D, (math.max (A-ratio2, B) × (-1) - C);
[0149] The first upper right corner texture coordinate (the first upper right corner vertex) = A + D, (math.min(ratio2-A,B)×(-1)+E);
[0150] The first upper left corner texture coordinate (the first upper left corner vertex) = (math.max(ratio2-A,B)×(-1)-C+math.min(A-ratio2,B)), (math.min(ratio2-A,B)×(-1)+E);
[0151] Among them, ratio2 is the aspect ratio of the first visible surface, A and B are respectively the endpoint values of the preset interval of the horizontal coordinate in the preset area range of the mapping coordinates of the first visible surface, or, A and B are respectively the endpoint values of the preset interval of the vertical coordinate in the preset area range of the mapping coordinates of the first visible surface. Usually, the preset intervals of the horizontal coordinate and the vertical coordinate in the preset area range of the mapping coordinates of the first visible surface are both 0 to 1, wherein A is greater than B, C, D and E are adjustment parameters for the mapping coordinates of the first visible surface, and the adjustment parameters are pre-set values, and their value range can be 0 to 2, which are used to adjust the mapping coordinates to be close to the center of the first visible surface to avoid that when the shape of the first visible surface is irregular, the mapping area obtained by multiple mapping coordinates is not completely within the first visible surface.
[0152] For example, the value of A may be 1, the value of B may be 0, the value of C may be 0.2, the value of D may be 0, and the value of E may be 1.2. In this case, the calculation formula for the multiple texture vertices of the first visible surface may be:
[0153] The first lower left vertex = (math.max(ratio2-1,0)×(-1)-0.2+math.min(1-ratio2,0)), (math.max(1-ratio2,0)×(-1)-0.2);
[0154] First lower right vertex = (math.max(1-ratio2,0)×(-1)-0.2);
[0155] The first upper right corner vertex = 1, (math.min(ratio2-1,0)×(-1)+1.2);
[0156] The first upper left corner vertex = (math.max(ratio2-1,0)×(-1)-0.2+math.min(1-ratio2,0)), (math.min(ratio2-1,0)×(-1)+1.2)
[0157] Through the above calculation formula, through the aspect ratio of the first visible surface and the preset area range of the mapping coordinates of the first visible surface, a rough plurality of mapping vertex coordinates can be obtained, and then according to the adjustment parameters of the mapping coordinates for the first visible surface, the rough plurality of vertex coordinates are adjusted to adjust the plurality of mapping coordinates to be close to the center of the first visible surface to avoid the mapping area obtained by the plurality of mapping coordinates not being completely within the first visible surface when the shape of the first visible surface is irregular, and a relatively reasonable plurality of vertex coordinates can be obtained, so as to obtain a relatively reasonable mapping area for the first visible surface.
[0158] In step S22, a plurality of mapping coordinates of the second visible surface are determined according to the aspect ratio of the first visible surface, the aspect ratio of the second visible surface, a preset area range of the mapping coordinates of the second visible surface, and adjustment parameters for the mapping coordinates of the second visible surface.
[0159] Specifically, first, according to the aspect ratio of the first visible surface and the aspect ratio of the second visible surface, the smaller aspect ratio is determined as a scaling parameter, and then, according to the scaling parameter and the aspect ratio of the second visible surface, the preset area range of the mapping coordinates of the second visible surface, and the adjustment parameters for the mapping coordinates of the second visible surface, the coordinates of multiple mapping vertices of the second visible surface are determined.
[0160] When there are two visible surfaces, the multiple mapping vertices of the visible surface with a smaller area (i.e., the second visible surface) are respectively the second lower left corner vertex, the second lower right corner vertex, the second upper right corner vertex, and the second upper left corner vertex. The specific calculation formula for the multiple mapping vertices of the second visible surface is:
[0161] The second lower left corner texture coordinate (the second lower left corner vertex) = b, (math.max(a-ratio3,b)×(-1)-c)×textureScale;
[0162] The second lower right corner texture coordinate (the second lower right corner vertex) = (math.min(a-ratio3,b)×(-1)+e+math.max(ratio3-a,b))×textureScale, (math.max(a-ratio3,b)×(-1)-c)×textureScale;
[0163] The second upper right corner texture coordinate (the second upper right corner vertex) = (math.min(a-ratio3,b)×(-1)+e+math.max(ratio3-a,b))×textureScale, (math.min(ratio3-a,b)×(-1)+e)×textureScale;
[0164] The second upper left corner texture coordinate (the second upper left corner vertex) = b, (math.min(ratio3-a,b)×(-1)+e)×textureScale;
[0165] Among them, ratio3 is the aspect ratio of the second visible surface, textureScale is the smaller value of the aspect ratio of the first visible surface and the aspect ratio of the second visible surface, a and b are respectively the endpoint values of the preset interval of the horizontal coordinate in the preset area range of the mapping coordinates of the first visible surface, or, a and b are respectively the endpoint values of the preset interval of the vertical coordinate in the preset area range of the mapping coordinates of the first visible surface. Usually, the preset intervals of the horizontal coordinate and the vertical coordinate in the preset area range of the mapping coordinates of the second visible surface are both 0 to 1, wherein a is greater than b, c, d and e are adjustment parameters for the mapping coordinates of the second visible surface, and the adjustment parameters are preset values, and their value range can be 0 to 2, which are used to adjust the mapping coordinates to be close to the center of the second visible surface to avoid that when the shape of the second visible surface is irregular, the mapping area obtained by multiple mapping coordinates is not completely within the second visible surface.
[0166] For example, the value of a may be 1, the value of b may be 0, the value of c may be 0.2, the value of d may be 0, and the value of e may be 1.2. In this case, the calculation formula for the multiple texture vertices of the second visible surface may be:
[0167] The second lower left vertex = 0, (math.max(1-ratio3,0)×(-1)-0.2)×textureScale;
[0168] The second lower right corner vertex = (math.min(1-ratio3,0)×(-1)+1.2+math.max(ratio3-1,0))×textureScale, (math.max(1-ratio3,0)×(-1)-0.2)×textureScale;
[0169] The second upper right corner vertex = (math.min(1-ratio3,0)×(-1)+1.2+math.max(ratio3-1,0))×textureScale, (math.min(ratio3-1,0)×(-1)+1.2)×textureScale;
[0170] The second upper left vertex = 0, (math.min(ratio3-1,0)×(-1)+1.2)×textureScale;
[0171] Through the above calculation formula, through the aspect ratio of the second visible surface, the preset area range and scaling parameters of the mapping coordinates of the second visible surface, a rough plurality of mapping vertex coordinates can be obtained, and then according to the adjustment parameters of the mapping coordinates for the second visible surface, the rough plurality of vertex coordinates are adjusted to adjust the plurality of mapping coordinates to be close to the center of the second visible surface to avoid the mapping area obtained by the plurality of mapping coordinates not being completely within the second visible surface when the shape of the second visible surface is irregular, and a relatively reasonable plurality of vertex coordinates can be obtained, so as to obtain a relatively reasonable mapping area for the second visible surface.
[0172] In step S23, a rectangular area enclosed by sequentially connecting the mapping vertices determined by each mapping coordinate of the first visible surface is determined as the mapping area of the first visible surface, and a rectangular area enclosed by sequentially connecting the mapping vertices determined by each mapping coordinate of the second visible surface is determined as the mapping area of the second visible surface.
[0173] After obtaining the coordinates of the multiple mapping vertices of the first visible surface, the multiple mapping vertices of the first visible surface can be determined by connecting the multiple mapping vertices of the first visible surface in a clockwise or counterclockwise order, and the enclosed area is the mapping area of the first visible surface.
[0174] After obtaining the coordinates of the multiple mapping vertices of the second visible surface, the multiple mapping vertices of the second visible surface can be determined by connecting the multiple mapping vertices of the second visible surface in a clockwise or counterclockwise order, and the enclosed area is the mapping area of the second visible surface.
[0175] Through the above method, when the visible surface includes the first visible surface and the second visible surface, the mapping areas for the first visible surface and the second visible surface can be calculated respectively, so that different mapping areas can be obtained according to different visible surfaces, so that the mapping area corresponding to each visible surface can be more suitable for its corresponding visible surface, thereby improving the mapping effect.
[0176] On the basis of the above technical solution, the three-dimensional model may have multiple visible surfaces. Since the same-sized textures are pasted on the multiple visible surfaces, in order to avoid the inappropriate size of the texture on the visible surface due to the different sizes of the visible surfaces, the original texture needs to be appropriately scaled to adapt to different visible surfaces at the same time. Specifically, according to the aspect ratio of the visible surface, the length and width of the original texture are scaled to obtain the target texture, including:
[0177] Determine the minimum aspect ratio of the multiple visible surfaces as a scaling parameter of the original texture;
[0178] The original texture is scaled proportionally according to the scaling parameter to obtain the target texture.
[0179] By determining the minimum aspect ratio of the aspect ratios of the multiple visible surfaces as the scaling parameter of the original texture, the original texture is scaled proportionally so as to obtain a target texture that is more suitable for the multiple visible surfaces. Specifically, the length and width of the original texture can be directly multiplied by the scaling parameter at the same time to obtain the target texture.
[0180] Filling the target texture into the texture area includes:
[0181] The target texture is filled into the texture areas of the respective multiple visible surfaces of the target three-dimensional model.
[0182] In this embodiment, the maps of the multiple visible surfaces are the same, and are all target maps. In this case, the target maps can be directly filled into the map areas of the multiple visible surfaces of the target three-dimensional model.
[0183] On the basis of the above technical solution, before the step of filling the target map into the map area, the filling method of the visible surface can be determined according to the type of the visible surface. Specifically,
[0184] When the aspect ratio of the visible surface is greater than a preset threshold, determining that the mapping mode of the visible surface is repeated horizontal filling, wherein the repeated horizontal filling is to fill the target mapping multiple times along the length direction of the mapping area;
[0185] Determining the number of times the target map is repeatedly filled in the length direction of the map area of the visible surface according to the length of the map area of the visible surface and the length of the target map;
[0186] The step of filling the target map into the map area includes:
[0187] According to the number of repeated filling times, the target map is repeatedly filled horizontally to the map area.
[0188] In this embodiment, when the aspect ratio of the visible surface is greater than a preset threshold, the type of the visible surface is short and fat. At this time, the width of the visible surface is larger and the height is smaller. It can be determined that the mapping method of the visible surface is repeated horizontal filling. By repeatedly filling the target texture in the length direction of the mapping area of the visible surface, the mapping area of the visible surface can be filled as completely as possible, and repeated horizontal filling can make the filling texture of the target texture more natural. The corresponding mapping filling method is determined according to the specific type of the visible surface to obtain a better mapping filling effect, wherein it is necessary to calculate the number of repeated filling times of the texture, and determine the number of repeated filling times of the target texture in the length direction of the mapping area of the visible surface according to the length of the mapping area of the visible surface and the length of the target texture. Specifically, the ratio of the length of the mapping area of the visible surface to the length of the target texture can be directly determined as the mapping repetition corresponding to the visible surface, and the preset threshold can be 1.
[0189] Filling the target texture into the texture area includes:
[0190] According to the number of repeated filling times, the target map is repeatedly filled horizontally to the map area.
[0191] On the basis of the above technical solution, before the step of filling the target map into the map area, the filling method of the visible surface can be determined according to the type of the visible surface. Specifically,
[0192] When the aspect ratio of the visible surface is less than a preset threshold, it is determined that the mapping mode of the visible surface is single horizontal filling, and the single horizontal filling is to fill the target mapping once in the mapping area.
[0193] The step of filling the target map into the map area includes:
[0194] The target map is filled horizontally to the middle of the map area.
[0195] When the aspect ratio of the visible surface is less than the preset threshold, the type of the visible surface can be considered to be tall and thin. At this time, the width of the visible surface is small and the height is large. The mapping method of the visible surface is determined to be single horizontal filling, and the target map is single horizontally filled to the middle of the mapping area. Among them, the preset threshold can be 1, and the upper and lower parts of the visible surface are no longer mapped. At this time, due to the small width of the visible surface, repeated horizontal filling cannot be performed. Repeated filling in the height direction will cause the texture of the map to be unnatural, resulting in poor mapping effect. Directly filling the target map single horizontally to the middle of the mapping area can make the mapping more natural.
[0196] On the basis of the above technical solution, when the visible surface of the target three-dimensional model includes a first visible surface and a second visible surface, and the area of the first visible surface is larger than that of the second visible surface, before the step of filling the target texture into the texture area, the method further includes:
[0197] When the aspect ratios of the first visible surface and the second visible surface are both greater than a preset threshold, the mapping mode of the first visible surface is determined to be repeated horizontal filling, and the mapping mode of the second visible surface is determined to be single horizontal filling, wherein the repeated horizontal filling is to fill the target mapping multiple times along the length direction of the mapping area, and the single horizontal filling is to fill the target mapping once in the middle of the mapping area;
[0198] Determining the number of times the target map is repeatedly filled in the length direction of the map area of the first visible surface according to the length of the map area of the first visible surface and the length of the target map;
[0199] The step of filling the target map into the map area includes:
[0200] According to the number of repeated filling times, the target texture is repeatedly filled horizontally to the texture area of the first visible surface, and the target texture is single-filled horizontally to the texture area of the second visible surface.
[0201] In the above implementation, when the aspect ratio of the first visible surface and the second visible surface is greater than the preset threshold, the first visible surface and the second visible surface are both short and fat, and the preset threshold here can be 1. At this time, the first visible surface with a larger area can be repeatedly filled horizontally, and the number of repeated fillings corresponding to the first visible surface is determined according to the size of the first visible surface and the size of the target map. The specific calculation method can refer to the calculation method of the number of repeated fillings mentioned above, which will not be repeated here. For the second visible surface with a smaller area, only a single horizontal filling can be performed to make the map more suitable for the size of the visible surface. Then, according to the number of repeated filling times corresponding to the first visible surface, the target texture is repeatedly filled horizontally to the texture area of the first visible surface, and the target texture is single-filled horizontally to the texture area of the second visible surface. According to the aspect ratio of the first visible surface and the second visible surface and the relative size of the area of the first visible surface and the second visible surface, the corresponding filling method is determined, so that the texture on each visible surface can be filled as completely as possible and the texture texture is more natural, thereby obtaining a better texture filling effect and making the texture more adaptable to the size of the visible surface.
[0202] Figure 3 is a schematic diagram of a mapping effect according to an exemplary embodiment, wherein the flower in the figure is the target mapping.
[0203] Figure 4FIG. 1 is a block diagram of a three-dimensional model mapping device according to an exemplary embodiment. Figure 4 The device includes an acquisition module 41, a first determination module 42, a second determination module 43, a scaling module 44 and a filling module 45.
[0204] The acquisition module 41 is configured to acquire coordinates of multiple vertices of a visible surface of a target three-dimensional model;
[0205] The first determining module 42 is configured to determine the aspect ratio of the visible surface according to the coordinates of the multiple vertices of the visible surface;
[0206] The second determining module 43 is configured to determine the mapping area of the visible surface according to the aspect ratio of the visible surface, a preset area range of mapping coordinates, and an adjustment parameter for the mapping coordinates, wherein the mapping coordinates are coordinates of a plurality of vertices that enclose the mapping area, and the adjustment parameter is used to make the mapping coordinates away from the edge of the visible surface;
[0207] The scaling module 44 is configured to scale the length and width of the original texture according to the aspect ratio of the visible surface to obtain a target texture;
[0208] A filling module is configured to fill the target map into the map area.
[0209] Optionally, the visible surface of the target three-dimensional model includes a first visible surface and a second visible surface, and an area of the first visible surface is greater than an area of the second visible surface, and the second determining module includes:
[0210] A first determining submodule is configured to determine a plurality of mapping coordinates of the first visible surface according to the aspect ratio of the first visible surface, a preset area range of the mapping coordinates of the first visible surface, and an adjustment parameter for the mapping coordinates of the first visible surface;
[0211] A second determining submodule is configured to determine a plurality of mapping coordinates of the second visible surface according to the aspect ratio of the first visible surface, the aspect ratio of the second visible surface, a preset area range of the mapping coordinates of the second visible surface, and an adjustment parameter for the mapping coordinates of the second visible surface;
[0212] The third determination submodule is configured to determine a rectangular area enclosed by sequentially connecting the mapping vertices determined by each mapping coordinate of the first visible surface as the mapping area of the first visible surface, and to determine a rectangular area enclosed by sequentially connecting the mapping vertices determined by each mapping coordinate of the second visible surface as the mapping area of the second visible surface.
[0213] Optionally, the second determining module includes:
[0214] a fifth determining submodule, configured to determine a plurality of mapping coordinates of the third visible surface according to the aspect ratio of the third visible surface, a preset area range of the mapping coordinates of the third visible surface, and an adjustment parameter for the mapping coordinates of the third visible surface;
[0215] The sixth determining submodule is configured to determine a rectangular area enclosed by sequentially connecting the mapping vertices determined by each mapping coordinate of the third visible surface as the mapping area of the third visible surface.
[0216] Optionally, the specific calculation formula for determining the multiple mapping coordinates of the first visible surface according to the aspect ratio of the first visible surface, the preset area range of the mapping coordinates of the first visible surface, and the adjustment parameters of the mapping coordinates of the first visible surface is:
[0217] The first lower left corner texture coordinates = (math.max(ratio2-A,B)×(-1)-C+math.min(A-ratio2,B)), (math.max(A-ratio 2,B)×(-1)-C);
[0218] The first lower right corner texture coordinate = A + D, (math.max (A-ratio2, B) × (-1) - C);
[0219] The first upper right corner texture coordinate = A+D, (math.min(ratio2-A,B)×(-1)+E);
[0220] The first upper left corner texture coordinates = (math.max(ratio2-A,B)×(-1)-C+math.min(A-ratio2,B)), (math.min(ratio2-A,B)×(-1)+E);
[0221] Among them, ratio2 is the aspect ratio of the first visible surface, A and B are respectively the endpoint values of the preset interval of the horizontal coordinate in the preset area range of the mapping coordinates of the first visible surface, or, A and B are respectively the endpoint values of the preset interval of the vertical coordinate in the preset area range of the mapping coordinates of the first visible surface, wherein A is greater than B, and C, D and E are adjustment parameters for the mapping coordinates of the first visible surface.
[0222] Optionally, the specific calculation formula according to the aspect ratio of the first visible surface, the aspect ratio of the second visible surface, the preset area range of the mapping coordinates of the second visible surface, and the adjustment parameters of the mapping coordinates of the second visible surface is:
[0223] The second lower left corner texture coordinate = b + d, (math.max (a-ratio3, b) × (-1) - c) × textureScale;
[0224] The second lower right corner texture coordinates = (math.min(a-ratio3,b)×(-1)+e+math.max(ratio3-a,b))×textureScale, (math.max(a-ratio3,b)×(-1)-c)×textureScale;
[0225] The second upper right corner texture coordinates = (math.min(a-ratio3,b)×(-1)+e+math.max(ratio3-a,b))×textureScale, (math.min(ratio3-a,b)×(-1)+e)×textureScale;
[0226] The second top left corner texture coordinate = b + d, (math.min(ratio3-a,b)×(-1)+e)×textureScale;
[0227] Among them, ratio3 is the aspect ratio of the second visible surface, textureScale is the smaller value of the aspect ratio of the first visible surface and the aspect ratio of the second visible surface, a and b are respectively the endpoint values of the preset interval of the horizontal coordinate in the preset area range of the mapping coordinates of the first visible surface, or, a and b are respectively the endpoint values of the preset interval of the vertical coordinate in the preset area range of the mapping coordinates of the first visible surface, wherein a is greater than b, and c, d and e are adjustment parameters for the mapping coordinates of the second visible surface.
[0228] Optionally, according to the aspect ratio of the third visible surface, the preset area range of the mapping coordinates of the third visible surface, and the adjustment parameters of the mapping coordinates of the third visible surface, a specific calculation formula for determining the multiple mapping coordinates of the third visible surface is:
[0229] The third lower left corner texture coordinates = math.max(ratio1-H,M)×(-1)-F, math.max(H-ratio1,M)×(-1)-F;
[0230] The third lower right corner texture coordinates = math.min(H-ratio1,M)×(-1)+G, math.max(H-ratio1,M)×(-1)-F;
[0231] The third upper right corner texture coordinates = math.min(H-ratio1,M)×(-1)+G, math.min(ratio1-H,M)×(-1)+G;
[0232] The third upper left corner texture coordinates = math.max(ratio1-H,M)×(-1)-F, math.min(ratio1-H,M)×(-1)+G;
[0233] Among them, ratio1 is the aspect ratio of the third visible surface, H and M are respectively the endpoint values of the preset interval of the horizontal coordinate in the preset area range of the mapping coordinates of the first visible surface, or, H and M are respectively the endpoint values of the preset interval of the vertical coordinate in the preset area range of the mapping coordinates of the first visible surface, wherein H is greater than M, and F and G are adjustment parameters for the mapping coordinates of the third visible surface.
[0234] Optionally, the target three-dimensional model has a plurality of visible surfaces, and the scaling module comprises:
[0235] A fourth determination submodule is configured to determine the minimum aspect ratio of the multiple visible surfaces as a scaling parameter of the original texture;
[0236] A scaling submodule is configured to scale the length and width of the original texture according to the scaling parameter to obtain the target texture;
[0237] The filling module comprises:
[0238] The first filling submodule is configured to fill the target texture into the texture areas of the multiple visible surfaces of the target three-dimensional model.
[0239] Optionally, the device further comprises:
[0240] A third determining module is configured to determine that the mapping mode of the visible surface is repeated horizontal filling when the aspect ratio of the visible surface is greater than a preset threshold, wherein the repeated horizontal filling is to fill the target mapping multiple times along the length direction of the mapping area;
[0241] A fourth determining module is configured to determine the number of times the target texture is repeatedly filled in the length direction of the texture area of the visible surface according to the length of the texture area of the visible surface and the length of the target texture;
[0242] The filling module comprises:
[0243] The second filling submodule is configured to repeatedly fill the target texture into the texture area horizontally according to the number of repeated filling times.
[0244] Optionally, the device further comprises:
[0245] a fifth determining module configured to determine that the mapping mode of the visible surface is single horizontal filling when the aspect ratio of the visible surface is less than a preset threshold, wherein the single horizontal filling is to fill the mapping area with the target texture once;
[0246] The filling module comprises:
[0247] The third filling submodule is configured to fill the target map horizontally to the middle of the map area.
[0248] Optionally, the visible surface of the target three-dimensional model includes a first visible surface and a second visible surface, and the area of the first visible surface is larger than that of the second visible surface, and the device further includes:
[0249] a sixth determining module, configured to, when the aspect ratio of the first visible surface and the aspect ratio of the second visible surface are both greater than a preset threshold, determine the mapping mode of the first visible surface as repeated horizontal filling, and determine the mapping mode of the second visible surface as single horizontal filling, wherein the repeated horizontal filling is to fill the target mapping multiple times along the length direction of the mapping area, and the single horizontal filling is to fill the target mapping once in the middle of the mapping area;
[0250] a seventh determining module, configured to determine the number of times the target texture is repeatedly filled in the length direction of the texture area of the first visible surface according to the length of the texture area of the first visible surface and the length of the target texture;
[0251] The filling module comprises:
[0252] The fourth filling submodule is configured to repeatedly fill the target texture into the texture area of the first visible surface horizontally according to the number of repeated filling times, and to fill the target texture into the texture area of the second visible surface horizontally only.
[0253] Regarding the device in the above embodiment, the specific manner in which each module performs operations has been described in detail in the embodiment of the method, and will not be elaborated here.
[0254] Figure 5 5 is a block diagram of an electronic device according to an exemplary embodiment. For example, the electronic device 500 may be a mobile phone, a computer, a digital broadcast terminal, a messaging device, a game console, a tablet device, a medical device, a fitness device, a personal digital assistant, etc.
[0255] Reference Figure 5, the electronic device 500 may include one or more of the following components: a processing component 502 , a memory 504 , a power component 506 , a multimedia component 508 , an audio component 510 , an input / output (I / O) interface 512 , a sensor component 514 , and a communication component 516 .
[0256] The processing component 502 generally controls the overall operation of the electronic device 500, such as operations associated with display, phone calls, data communications, camera operations, and recording operations. The processing component 502 may include one or more processors 520 to execute instructions to complete all or part of the steps of the above-mentioned method. In addition, the processing component 502 may include one or more modules to facilitate the interaction between the processing component 502 and other components. For example, the processing component 502 may include a multimedia module to facilitate the interaction between the multimedia component 508 and the processing component 502.
[0257] The memory 504 is configured to store various types of data to support operations on the electronic device 500. Examples of such data include instructions for any application or method operating on the electronic device 500, contact data, phone book data, messages, pictures, videos, etc. The memory 504 can be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk.
[0258] The power supply component 506 provides power to the various components of the electronic device 500. The power supply component 506 may include a power management system, one or more power supplies, and other components associated with generating, managing, and distributing power to the electronic device 500.
[0259] The multimedia component 508 includes a screen that provides an output interface between the electronic device 500 and the user. In some embodiments, the screen may include a liquid crystal display (LCD) and a touch panel (TP). If the screen includes a touch panel, the screen may be implemented as a touch screen to receive input signals from the user. The touch panel includes one or more touch sensors to sense touch, slide, and gestures on the touch panel. The touch sensor may not only sense the boundaries of the touch or slide action, but also detect the duration and pressure associated with the touch or slide operation. In some embodiments, the multimedia component 508 includes a front camera and / or a rear camera. When the electronic device 500 is in an operating mode, such as a shooting mode or a video mode, the front camera and / or the rear camera may receive external multimedia data. Each front camera and rear camera may be a fixed optical lens system or have a focal length and optical zoom capability.
[0260] The audio component 510 is configured to output and / or input audio signals. For example, the audio component 510 includes a microphone (MIC), and when the electronic device 500 is in an operating mode, such as a call mode, a recording mode, and a voice recognition mode, the microphone is configured to receive an external audio signal. The received audio signal can be further stored in the memory 504 or sent via the communication component 516. In some embodiments, the audio component 510 also includes a speaker for outputting audio signals.
[0261] I / O interface 512 provides an interface between processing component 502 and peripheral interface modules, such as keyboards, click wheels, buttons, etc. These buttons may include but are not limited to: a home button, a volume button, a start button, and a lock button.
[0262] The sensor assembly 514 includes one or more sensors for providing various aspects of status assessment for the electronic device 500. For example, the sensor assembly 514 can detect the open / closed state of the electronic device 500, the relative positioning of components, such as the display and keypad of the electronic device 500, and the sensor assembly 514 can also detect the position change of the electronic device 500 or a component of the electronic device 500, the presence or absence of user contact with the electronic device 500, the orientation or acceleration / deceleration of the electronic device 500, and the temperature change of the electronic device 500. The sensor assembly 514 may include a proximity sensor configured to detect the presence of nearby objects without any physical contact. The sensor assembly 514 may also include an optical sensor, such as a CMOS or CCD image sensor, for use in imaging applications. In some embodiments, the sensor assembly 514 may also include an acceleration sensor, a gyroscope sensor, a magnetic sensor, a pressure sensor, or a temperature sensor.
[0263] The communication component 516 is configured to facilitate wired or wireless communication between the electronic device 500 and other devices. The electronic device 500 can access a wireless network based on a communication standard, such as WiFi, a carrier network (such as 2G, 3G, 5G or 5G), or a combination thereof. In an exemplary embodiment, the communication component 516 receives a broadcast signal or broadcast-related information from an external broadcast management system via a broadcast channel. In an exemplary embodiment, the communication component 516 also includes a near field communication (NFC) module to facilitate short-range communication. For example, the NFC module can be implemented based on radio frequency identification (RFID) technology, infrared data association (IrDA) technology, ultra-wideband (UWB) technology, Bluetooth (BT) technology and other technologies.
[0264] In an exemplary embodiment, the electronic device 500 can be implemented by one or more application-specific integrated circuits (ASICs), digital signal processors (DSPs), digital signal processing devices (DSPDs), programmable logic devices (PLDs), field programmable gate arrays (FPGAs), controllers, microcontrollers, microprocessors or other electronic components to execute the above-mentioned three-dimensional model mapping method.
[0265] In an exemplary embodiment, a computer-readable storage medium is also provided, such as a memory 504 including instructions, which can be executed by a processor 520 of an electronic device 500 to complete the above-mentioned three-dimensional model mapping method. Optionally, the computer-readable storage medium can be a non-transitory computer-readable storage medium, for example, the non-transitory computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0266] In an exemplary embodiment, a computer program product is also provided, the computer program product includes a computer program, the computer program can be executed by the processor 520 of the electronic device 500 to complete the above-mentioned three-dimensional model mapping method. Optionally, the computer program can be stored in a computer-readable storage medium of the electronic device 500, and the computer-readable storage medium can be a non-temporary computer-readable storage medium, for example, the non-temporary computer-readable storage medium can be a ROM, a random access memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, etc.
[0267] Those skilled in the art will readily appreciate other embodiments of the present disclosure after considering the specification and practicing the invention disclosed herein. This application is intended to cover any variations, uses, or adaptations of the present disclosure that follow the general principles of the present disclosure and include common knowledge or customary techniques in the art that are not disclosed in the present disclosure. The specification and examples are intended to be exemplary only, and the true scope and spirit of the present disclosure are indicated by the following claims.
[0268] It should be understood that the present invention is not limited to the exact construction that has been described above and shown in the drawings and that various modifications and changes may be made without departing from the scope thereof. The scope of the present invention is limited only by the appended claims.
Claims
1. A three-dimensional model mapping method, characterized in that: The method comprises: Obtaining coordinates of multiple vertices of a visible surface of a target three-dimensional model; Determining the aspect ratio of the visible surface according to the coordinates of the multiple vertices of the visible surface; Determining a mapping area of the visible surface according to the aspect ratio of the visible surface, a preset area range of mapping coordinates, and an adjustment parameter for the mapping coordinates, wherein the mapping coordinates are coordinates of a plurality of vertices surrounding the mapping area, and the adjustment parameter is used to move the mapping coordinates away from an edge of the visible surface; Scaling the length and width of the original texture according to the aspect ratio of the visible surface to obtain a target texture; Filling the target texture into the texture area; The visible surface of the target three-dimensional model includes a first visible surface and a second visible surface, and the area of the first visible surface is greater than the area of the second visible surface, and the determining of the mapping area of the visible surface according to the aspect ratio of the visible surface, the preset area range of the mapping coordinates, and the adjustment parameters for the mapping coordinates includes: Determining a plurality of mapping coordinates of the first visible surface according to the aspect ratio of the first visible surface, a preset area range of the mapping coordinates of the first visible surface, and an adjustment parameter for the mapping coordinates of the first visible surface; Determining a plurality of mapping coordinates of the second visible surface according to the aspect ratio of the first visible surface, the aspect ratio of the second visible surface, a preset area range of mapping coordinates of the second visible surface, and adjustment parameters for the mapping coordinates of the second visible surface; Determine a rectangular area enclosed by sequentially connecting the mapping vertices determined by each mapping coordinate of the first visible surface as the mapping area of the first visible surface, and determine a rectangular area enclosed by sequentially connecting the mapping vertices determined by each mapping coordinate of the second visible surface as the mapping area of the second visible surface; Wherein, determining a plurality of mapping coordinates of the second visible surface according to the aspect ratio of the first visible surface, the aspect ratio of the second visible surface, a preset area range of the mapping coordinates of the second visible surface, and an adjustment parameter for the mapping coordinates of the second visible surface comprises: A smaller aspect ratio is determined from the aspect ratio of the first visible surface and the aspect ratio of the second visible surface as a scaling parameter, and the coordinates of multiple mapping vertices of the second visible surface are determined according to the scaling parameter, the aspect ratio of the second visible surface, the preset area range of the mapping coordinates of the second visible surface, and the adjustment parameters of the mapping coordinates of the second visible surface.
2. The method according to claim 1, characterized in that: The visible surface of the target three-dimensional model further includes a third visible surface, and determining the mapping area of the visible surface according to the aspect ratio of the visible surface, the preset area range of the mapping coordinates, and the adjustment parameters for the mapping coordinates includes: Determining a plurality of mapping coordinates of the third visible surface according to the aspect ratio of the third visible surface, a preset area range of the mapping coordinates of the third visible surface, and adjustment parameters for the mapping coordinates of the third visible surface; A rectangular area enclosed by sequentially connecting the mapping vertices determined by each mapping coordinate of the third visible surface is determined as the mapping area of the third visible surface.
3. The method according to claim 1, characterized in that The specific calculation formula for determining the plurality of mapping coordinates of the first visible surface according to the aspect ratio of the first visible surface, the preset area range of the mapping coordinates of the first visible surface, and the adjustment parameters of the mapping coordinates of the first visible surface is: The first lower left corner texture coordinates = (math.max(ratio2-A,B)×(-1)-C+math.min(A-ratio2,B)), (math.max(A-ratio 2,B)×(-1)-C); The first lower right corner texture coordinate = A + D, (math.max (A-ratio2, B) × (-1) - C); The first upper right corner texture coordinate = A+D, (math.min(ratio2-A,B)×(-1)+E); The first upper left corner texture coordinates = (math.max(ratio2-A,B)×(-1)-C+math.min(A-ratio2,B)), (math.min(ratio2-A,B)×(-1)+E); Among them, ratio2 is the aspect ratio of the first visible surface, A and B are respectively the endpoint values of the preset interval of the horizontal coordinate in the preset area range of the mapping coordinates of the first visible surface, or, A and B are respectively the endpoint values of the preset interval of the vertical coordinate in the preset area range of the mapping coordinates of the first visible surface, wherein A is greater than B, and C, D and E are adjustment parameters for the mapping coordinates of the first visible surface.
4. The method according to claim 1, characterized in that: The specific calculation formula according to the aspect ratio of the first visible surface, the aspect ratio of the second visible surface, the preset area range of the mapping coordinates of the second visible surface, and the adjustment parameters of the mapping coordinates of the second visible surface is: The second lower left corner texture coordinate = b + d, (math.max (a-ratio3, b) × (-1) - c) × textureScale; The second lower right corner texture coordinates = (math.min(a-ratio3,b)×(-1)+e+math.max(ratio3-a,b))×textureScale, (math.max(a-ratio3,b)×(-1)-c)×textureScale; The second upper right corner texture coordinates = (math.min(a-ratio3,b)×(-1)+e+math.max(ratio3-a,b))×textureScale, (math.min(ratio3-a,b)×(-1)+e)×textureScale; The second top left corner texture coordinate = b + d, (math.min(ratio3-a,b)×(-1)+e)×textureScale; Among them, ratio3 is the aspect ratio of the second visible surface, textureScale is the smaller value of the aspect ratio of the first visible surface and the aspect ratio of the second visible surface, a and b are respectively the endpoint values of the preset interval of the horizontal coordinate in the preset area range of the mapping coordinates of the first visible surface, or, a and b are respectively the endpoint values of the preset interval of the vertical coordinate in the preset area range of the mapping coordinates of the first visible surface, wherein a is greater than b, and c, d and e are adjustment parameters for the mapping coordinates of the second visible surface.
5. The method according to claim 2, characterized in that: According to the aspect ratio of the third visible surface, the preset area range of the mapping coordinates of the third visible surface, and the adjustment parameters of the mapping coordinates of the third visible surface, a specific calculation formula for determining the multiple mapping coordinates of the third visible surface is: The third lower left corner texture coordinates = math.max(ratio1-H,M)×(-1)-F, math.max(H-ratio1,M)×(-1)-F; The third lower right corner texture coordinates = math.min(H-ratio1,M)×(-1)+G, math.max(H-ratio1,M)×(-1)-F; The third upper right corner texture coordinates = math.min(H-ratio1,M)×(-1)+G, math.min(ratio1-H,M)×(-1)+G; The third upper left corner texture coordinates = math.max(ratio1-H,M)×(-1)-F, math.min(ratio1-H,M)×(-1)+G; Among them, ratio1 is the aspect ratio of the third visible surface, H and M are respectively the endpoint values of the preset interval of the horizontal coordinate in the preset area range of the mapping coordinates of the third visible surface, or, H and M are respectively the endpoint values of the preset interval of the vertical coordinate in the preset area range of the mapping coordinates of the third visible surface, wherein H is greater than M, and F and G are adjustment parameters for the mapping coordinates of the third visible surface.
6. The method according to claim 1, characterized in that The target three-dimensional model has a plurality of visible surfaces, and scaling the length and width of the original texture according to the aspect ratio of the visible surfaces to obtain the target texture includes: Determine the minimum aspect ratio of the multiple visible surfaces as a scaling parameter of the original texture; According to the scaling parameter, scaling the length and width of the original texture to obtain the target texture; Filling the target texture into the texture area, comprising: The target texture is filled into the texture areas of the respective multiple visible surfaces of the target three-dimensional model.
7. The method according to claim 1, characterized in that Before the step of filling the target texture into the texture area, the method further includes: When the aspect ratio of the visible surface is greater than a preset threshold, determining that the mapping mode of the visible surface is repeated horizontal filling, wherein the repeated horizontal filling is to fill the target mapping multiple times along the length direction of the mapping area; Determining the number of times the target map is repeatedly filled in the length direction of the map area of the visible surface according to the length of the map area of the visible surface and the length of the target map; The step of filling the target map into the map area includes: According to the number of repeated filling times, the target map is repeatedly filled horizontally to the map area.
8. The method according to claim 1, characterized in that: Before the step of filling the target texture into the texture area, the method further includes: When the aspect ratio of the visible surface is less than a preset threshold, determining that the mapping mode of the visible surface is single horizontal filling, wherein the single horizontal filling is to fill the mapping area with the target texture once; The step of filling the target map into the map area includes: The target map is filled horizontally to the middle of the map area.
9. The method according to claim 1, characterized in that: The visible surface of the target three-dimensional model includes a first visible surface and a second visible surface, and the area of the first visible surface is larger than that of the second visible surface. Before the step of filling the target texture into the texture area, the method further includes: When the aspect ratio of the first visible surface and the aspect ratio of the second visible surface are both greater than a preset threshold, the mapping mode of the first visible surface is determined as repeated horizontal filling, and the mapping mode of the second visible surface is determined as single horizontal filling, wherein the repeated horizontal filling is to fill the target mapping multiple times along the length direction of the mapping area, and the single horizontal filling is to fill the target mapping once in the middle of the mapping area; Determining the number of times the target map is repeatedly filled in the length direction of the map area of the first visible surface according to the length of the map area of the first visible surface and the length of the target map; The step of filling the target map into the map area includes: According to the number of repeated filling times, the target texture is repeatedly filled horizontally to the texture area of the first visible surface, and the target texture is single-filled horizontally to the texture area of the second visible surface.
10. A three-dimensional model mapping device, characterized in that: The device comprises: An acquisition module is configured to acquire coordinates of multiple vertices of a visible surface of a target three-dimensional model; A first determining module is configured to determine the aspect ratio of the visible surface according to the plurality of vertex coordinates of the visible surface; A second determining module is configured to determine a mapping area of the visible surface according to the aspect ratio of the visible surface, a preset area range of mapping coordinates, and an adjustment parameter for the mapping coordinates, wherein the mapping coordinates are coordinates of a plurality of vertices that enclose the mapping area, and the adjustment parameter is used to move the mapping coordinates away from an edge of the visible surface; A scaling module is configured to scale the length and width of the original texture according to the aspect ratio of the visible surface to obtain a target texture; A filling module, configured to fill the target map into the map area; The visible surface of the target three-dimensional model includes a first visible surface and a second visible surface, and the area of the first visible surface is greater than the area of the second visible surface, and the second determining module includes: A first determining submodule is configured to determine a plurality of mapping coordinates of the first visible surface according to the aspect ratio of the first visible surface, a preset area range of the mapping coordinates of the first visible surface, and an adjustment parameter for the mapping coordinates of the first visible surface; A second determining submodule is configured to determine a plurality of mapping coordinates of the second visible surface according to the aspect ratio of the first visible surface, the aspect ratio of the second visible surface, a preset area range of the mapping coordinates of the second visible surface, and an adjustment parameter for the mapping coordinates of the second visible surface; a third determining submodule, configured to determine a rectangular area enclosed by sequentially connecting the mapping vertices determined by each mapping coordinate of the first visible surface as the mapping area of the first visible surface, and to determine a rectangular area enclosed by sequentially connecting the mapping vertices determined by each mapping coordinate of the second visible surface as the mapping area of the second visible surface; Among them, the second determination submodule is specifically used to determine a smaller aspect ratio from the aspect ratio of the first visible surface and the aspect ratio of the second visible surface as a scaling parameter, and determine the coordinates of multiple mapping vertices of the second visible surface according to the scaling parameter, the aspect ratio of the second visible surface, the preset area range of the mapping coordinates of the second visible surface, and the adjustment parameters of the mapping coordinates of the second visible surface.
11. The device according to claim 10, characterized in that The visible surface of the target three-dimensional model further includes a third visible surface, and the second determining module includes: a fifth determining submodule, configured to determine a plurality of mapping coordinates of the third visible surface according to the aspect ratio of the third visible surface, a preset area range of the mapping coordinates of the third visible surface, and an adjustment parameter for the mapping coordinates of the third visible surface; The sixth determining submodule is configured to determine a rectangular area enclosed by sequentially connecting the mapping vertices determined by each mapping coordinate of the third visible surface as the mapping area of the third visible surface.
12. The device according to claim 10, characterized in that The specific calculation formula for determining the plurality of mapping coordinates of the first visible surface according to the aspect ratio of the first visible surface, the preset area range of the mapping coordinates of the first visible surface, and the adjustment parameters of the mapping coordinates of the first visible surface is: The first lower left corner texture coordinates = (math.max(ratio2-A,B)×(-1)-C+math.min(A-ratio2,B)), (math.max(A-ratio 2,B)×(-1)-C); The first lower right corner texture coordinate = A + D, (math.max (A-ratio2, B) × (-1) - C); The first upper right corner texture coordinate = A+D, (math.min(ratio2-A,B)×(-1)+E); The first upper left corner texture coordinates = (math.max(ratio2-A,B)×(-1)-C+math.min(A-ratio2,B)), (math.min(ratio2-A,B)×(-1)+E); Among them, ratio2 is the aspect ratio of the first visible surface, A and B are respectively the endpoint values of the preset interval of the horizontal coordinate in the preset area range of the mapping coordinates of the first visible surface, or, A and B are respectively the endpoint values of the preset interval of the vertical coordinate in the preset area range of the mapping coordinates of the first visible surface, wherein A is greater than B, and C, D and E are adjustment parameters for the mapping coordinates of the first visible surface.
13. The device according to claim 10, characterized in that The specific calculation formula according to the aspect ratio of the first visible surface, the aspect ratio of the second visible surface, the preset area range of the mapping coordinates of the second visible surface, and the adjustment parameters of the mapping coordinates of the second visible surface is: The second lower left corner texture coordinate = b + d, (math.max (a-ratio3, b) × (-1) - c) × textureScale; The second lower right corner texture coordinates = (math.min(a-ratio3,b)×(-1)+e+math.max(ratio3-a,b))×textureScale, (math.max(a-ratio3,b)×(-1)-c)×textureScale; The second upper right corner texture coordinates = (math.min(a-ratio3,b)×(-1)+e+math.max(ratio3-a,b))×textureScale, (math.min(ratio3-a,b)×(-1)+e)×textureScale; The second top left corner texture coordinate = b + d, (math.min(ratio3-a,b)×(-1)+e)×textureScale; Among them, ratio3 is the aspect ratio of the second visible surface, textureScale is the smaller value of the aspect ratio of the first visible surface and the aspect ratio of the second visible surface, a and b are respectively the endpoint values of the preset interval of the horizontal coordinate in the preset area range of the mapping coordinates of the first visible surface, or, a and b are respectively the endpoint values of the preset interval of the vertical coordinate in the preset area range of the mapping coordinates of the first visible surface, wherein a is greater than b, and c, d and e are adjustment parameters for the mapping coordinates of the second visible surface.
14. The device according to claim 11, characterized in that According to the aspect ratio of the third visible surface, the preset area range of the mapping coordinates of the third visible surface, and the adjustment parameters of the mapping coordinates of the third visible surface, a specific calculation formula for determining the multiple mapping coordinates of the third visible surface is: The third lower left corner texture coordinates = math.max(ratio1-H,M)×(-1)-F, math.max(H-ratio1,M)×(-1)-F; The third lower right corner texture coordinates = math.min(H-ratio1,M)×(-1)+G, math.max(H-ratio1,M)×(-1)-F; The third upper right corner texture coordinates = math.min(H-ratio1,M)×(-1)+G, math.min(ratio1-H,M)×(-1)+G; The third upper left corner texture coordinates = math.max(ratio1-H,M)×(-1)-F, math.min(ratio1-H,M)×(-1)+G; Among them, ratio1 is the aspect ratio of the third visible surface, H and M are respectively the endpoint values of the preset interval of the horizontal coordinate in the preset area range of the mapping coordinates of the third visible surface, or, H and M are respectively the endpoint values of the preset interval of the vertical coordinate in the preset area range of the mapping coordinates of the third visible surface, wherein H is greater than M, and F and G are adjustment parameters for the mapping coordinates of the third visible surface.
15. The device according to claim 10, characterized in that The target three-dimensional model has a plurality of visible surfaces, and the scaling module comprises: A fourth determination submodule is configured to determine the minimum aspect ratio of the multiple visible surfaces as a scaling parameter of the original texture; A scaling submodule, configured to scale the length and width of the original texture according to the scaling parameter to obtain the target texture; The filling module comprises: The first filling submodule is configured to fill the target texture into the texture areas of the multiple visible surfaces of the target three-dimensional model.
16. The device according to claim 10, characterized in that The device also includes: A third determining module is configured to determine that the mapping mode of the visible surface is repeated horizontal filling when the aspect ratio of the visible surface is greater than a preset threshold, wherein the repeated horizontal filling is to fill the target mapping multiple times along the length direction of the mapping area; A fourth determining module is configured to determine the number of times the target texture is repeatedly filled in the length direction of the texture area of the visible surface according to the length of the texture area of the visible surface and the length of the target texture; The filling module comprises: The second filling submodule is configured to repeatedly fill the target texture into the texture area horizontally according to the number of repeated filling times.
17. The device according to claim 10, characterized in that The device also includes: a fifth determining module configured to determine that the mapping mode of the visible surface is single horizontal filling when the aspect ratio of the visible surface is less than a preset threshold, wherein the single horizontal filling is to fill the mapping area with the target texture once; The filling module comprises: The third filling submodule is configured to fill the target map horizontally to the middle of the map area.
18. The device according to claim 10, characterized in that The visible surface of the target three-dimensional model includes a first visible surface and a second visible surface, and the area of the first visible surface is larger than that of the second visible surface, and the device further includes: a sixth determining module, configured to, when the aspect ratio of the first visible surface and the aspect ratio of the second visible surface are both greater than a preset threshold, determine the mapping mode of the first visible surface as repeated horizontal filling, and determine the mapping mode of the second visible surface as single horizontal filling, wherein the repeated horizontal filling is to fill the target mapping multiple times along the length direction of the mapping area, and the single horizontal filling is to fill the target mapping once in the middle of the mapping area; a seventh determining module, configured to determine the number of times the target texture is repeatedly filled in the length direction of the texture area of the first visible surface according to the length of the texture area of the first visible surface and the length of the target texture; The filling module comprises: The fourth filling submodule is configured to repeatedly fill the target texture into the texture area of the first visible surface horizontally according to the number of repeated filling times, and to fill the target texture into the texture area of the second visible surface horizontally only.
19. An electronic device, characterized in that: include: processor; a memory for storing instructions executable by the processor; The processor is configured to execute the instructions to implement the three-dimensional model mapping method as described in any one of claims 1 to 9.
20. A computer-readable storage medium, characterized in that: When the instructions in the computer-readable storage medium are executed by a processor of an electronic device, the electronic device is enabled to execute the three-dimensional model mapping method as described in any one of claims 1 to 9.
21. A computer program product, comprising a computer program, characterized in that When the computer program is executed by a processor, the three-dimensional model mapping method according to any one of claims 1 to 9 is implemented.
Citation Information
Patent Citations
Baking method and device for water system, storage medium and electronic device
CN111862291A
Picture processing method and device, computer readable storage medium and electronic equipment
CN113487717A