A method and apparatus for determining a boundary of a UV shell, an electronic device, and a storage medium
By sorting and deduplicating the UV coordinates, and using the reference count of the UV triangle sides to determine the boundary of the UV shell, the problem of inaccurate UV shell boundary determination is solved, and more accurate UV shell boundary determination is achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHANGSHA MORALE NETWORK TECH CO LTD
- Filing Date
- 2023-05-05
- Publication Date
- 2026-07-10
AI Technical Summary
The boundary determination of the UV shell in the existing technology is inaccurate, especially when faced with repeated UV coordinates, which leads to judgment errors.
By sorting and deduplicating the UV coordinates, duplicate UV coordinates are generated. The boundary of the UV shell is determined by the reference count of the UV triangle sides, and duplicate UV coordinates are removed.
The method accurately determines the boundary of the UV shell, solving the problem of inaccurate judgment caused by repeated UV coordinates in the prior art and improving the accuracy of UV shell boundary judgment.
Smart Images

Figure CN116681720B_ABST
Abstract
Description
Technical Field
[0001] This application relates to the field of three-dimensional model processing technology, and in particular to a method, apparatus, electronic device, and storage medium for determining the boundary of a UV shell. Background Technology
[0002] In computer graphics, texture coordinates are a two-dimensional coordinate system with the horizontal direction represented by U and the vertical direction by V. UV coordinates allow the location of any pixel on a texture image. UV coordinates, short for U and V texture mapping coordinates, also known as texture mapping coordinates, define the position of each point in a two-dimensional image. In virtual models, UV coordinates precisely map each point on the image to the surface of the virtual model, enabling the virtual model to exhibit corresponding visual effects.
[0003] UV coordinates describe the correspondence between texture maps and skinned meshes, mapping the pixels of the texture map onto the surface of the skinned mesh to create richer animation effects. All UV coordinates constitute a UV map, and a skinned animation corresponds to one or more UV maps. For a single UV map, each triangle in the skinned mesh corresponds to a UV triangle, and the adjacency relationship between UV triangles is determined by whether they share a common edge. The set of all adjacent UV triangles is called the UV shell.
[0004] Currently, the boundary of a UV shell is generally determined by the reference count of the UV triangle edges, assuming that the edge with a reference count of 1 lies on the boundary of the UV shell. However, this method is affected by repeated UV coordinates, leading to inaccurate boundary determination of the UV shell.
[0005] There is currently no effective solution to the problem of inaccurate boundary determination of UV shells in existing technologies. Summary of the Invention
[0006] This embodiment provides a method, apparatus, electronic device, and storage medium for determining the boundary of a UV shell, in order to solve the problem of inaccurate boundary determination of UV shells in the prior art.
[0007] Firstly, this embodiment provides a method for determining the boundary of a UV shell, the method comprising:
[0008] Obtain the UV coordinates of the skinned animation;
[0009] The UV coordinates are sorted according to their coordinate values.
[0010] The sorted UV coordinates are deduplicated to generate duplicated UV coordinates.
[0011] The boundary of the UV shell is determined based on the deduplicated UV coordinates.
[0012] In some embodiments, determining the boundary of the UV shell based on the deduplicated UV coordinates includes:
[0013] Update the vertex coordinate index of the UV triangle based on the deduplicated UV coordinates;
[0014] Retrieve the number of times each UV edge is referenced by the UV triangle;
[0015] The boundary of the UV shell is determined based on the number of times it is referenced.
[0016] In some embodiments, determining the boundary of the UV shell based on the number of references includes:
[0017] The UV edge with a reference count of 1 is determined as the boundary of the UV shell.
[0018] In some embodiments, the UV shell is the area enclosed by the boundary of the UV shell.
[0019] In some embodiments, the step of deduplicating the sorted UV coordinates to generate duplicated UV coordinates includes:
[0020] Based on the sorted UV coordinates, compare the distances between adjacent groups of UV coordinates in turn;
[0021] When the distance between the UV coordinates of two adjacent groups meets the preset value, the UV coordinates of the latter group in the two adjacent groups are marked as redundant UV coordinates, and the coordinate values of the UV coordinates of the former group in the two adjacent groups are updated to the average value of the coordinate values of the two groups of UV coordinates.
[0022] Delete the redundant UV coordinates.
[0023] In some embodiments, the UV coordinates range from 0 to 1, and the preset value ranges from 10. -6 Up to 10 -8 .
[0024] Secondly, this embodiment provides a boundary determination device for a UV shell, the device comprising:
[0025] The acquisition module is used to obtain the UV coordinates of the skinned animation;
[0026] The sorting module is used to sort the UV coordinates according to their coordinate values.
[0027] The generation module is used to deduplicate the sorted UV coordinates and generate duplicate UV coordinates.
[0028] The determination module is used to determine the boundary of the UV shell based on the deduplicated UV coordinates.
[0029] In some embodiments, the generation module includes:
[0030] The comparison unit is used to compare the distance between adjacent UV coordinates in turn based on the sorted UV coordinates;
[0031] The update unit is used to mark the latter group of UV coordinates in the two adjacent groups as redundant UV coordinates and update the coordinate value of the former group of UV coordinates in the two adjacent groups to the average value of the coordinate values of the two groups of UV coordinates when the distance between the two adjacent groups meets the preset value.
[0032] The deletion unit is used to delete the redundant UV coordinates.
[0033] Thirdly, this embodiment provides an electronic device including a memory and a processor, wherein the memory stores a computer program and the processor is configured to run the computer program to perform the UV shell boundary determination method described in the first aspect.
[0034] Fourthly, this embodiment provides a computer-readable storage medium having a computer program stored thereon, which, when executed by a processor, implements the steps of the UV shell boundary determination method described in the first aspect.
[0035] Compared with the prior art, the UV shell boundary determination method, apparatus, electronic device and storage medium provided in this embodiment sort the UV coordinates according to their coordinate values, remove duplicate UV coordinates from the sorted UV coordinates, and determine the boundary of the UV shell based on the deduplicated UV coordinates. When determining the boundary of the UV shell by the reference count of the UV triangle sides, duplicate UV coordinates are removed, thereby solving the problem of inaccurate boundary determination of the UV shell in the prior art.
[0036] Details of one or more embodiments of this application are set forth in the following drawings and description to make other features, objects and advantages of this application more readily apparent. Attached Figure Description
[0037] The accompanying drawings, which are included to provide a further understanding of this application and form part of this application, illustrate exemplary embodiments and are used to explain this application, but do not constitute an undue limitation of this application. In the drawings:
[0038] Figure 1 This is a hardware structure block diagram of a terminal that executes a UV shell boundary determination method according to an embodiment of this application;
[0039] Figure 2 This is a flowchart of a method for determining the boundary of a UV shell according to an embodiment of this application;
[0040] Figure 3 This is a flowchart of a method for determining the boundary of a UV shell according to a specific embodiment of the present invention;
[0041] Figure 4 This is a flowchart of another method for determining the boundary of a UV shell according to this specific embodiment;
[0042] Figure 5 This is a structural block diagram of a UV shell boundary determination device according to an embodiment of this application. Detailed Implementation
[0043] To better understand the purpose, technical solution, and advantages of this application, the application is described and illustrated below in conjunction with the accompanying drawings and embodiments.
[0044] Unless otherwise defined, the technical or scientific terms used in this application shall have the general meaning as understood by one of ordinary skill in the art to which this application pertains. Words such as “a,” “an,” “an,” “the,” “the,” and “these,” used in this application, do not indicate quantitative limitation and may be singular or plural. The terms “comprising,” “including,” “having,” and any variations thereof used in this application are intended to cover non-exclusive inclusion; for example, a process, method, system, product, or device that comprises a series of steps or modules (units) is not limited to the listed steps or modules (units) but may include steps or modules (units) not listed, or may include other steps or modules (units) inherent to such processes, methods, products, or devices. The terms “connected,” “linked,” and “coupled,” used in this application, are not limited to physical or mechanical connections but may include electrical connections, whether direct or indirect. The term “multiple” used in this application refers to two or more. The "and / or" operator describes the relationship between related objects, indicating that three relationships can exist. For example, "A and / or B" can represent three cases: A alone, A and B simultaneously, and B alone. Typically, the character " / " indicates that the objects before and after it are in an "or" relationship. The terms "first," "second," and "third," etc., used in this application are merely for distinguishing similar objects and do not represent a specific ordering of the objects.
[0045] The method embodiments provided in this example can be executed on a terminal, computer, or similar computing device. For example, it can run on a terminal. Figure 1 This is a hardware structure block diagram of a terminal executing a UV shell boundary determination method according to an embodiment of this application. For example... Figure 1As shown, a terminal may include one or more ( Figure 1 Only one is shown in the diagram. A processor 102 and a memory 104 for storing data are also included. The processor 102 may be, but is not limited to, a microprocessor (MCU) or a programmable logic device (FPGA). The terminal may also include a transmission device 106 for communication functions and an input / output device 108. Those skilled in the art will understand that… Figure 1 The structure shown is for illustrative purposes only and does not limit the structure of the terminal described above. For example, the terminal may also include components that are larger than... Figure 1 The more or fewer components shown, or having the same Figure 1 The different configurations shown are illustrated.
[0046] The memory 104 can be used to store computer programs, such as application software programs and modules, like the computer program corresponding to a UV shell boundary determination method in this embodiment. The processor 102 executes various functional applications and data processing by running the computer programs stored in the memory 104, thereby implementing the aforementioned method. The memory 104 may include high-speed random access memory and may also include non-volatile memory, such as one or more magnetic storage devices, flash memory, or other non-volatile solid-state memory. In some instances, the memory 104 may further include memory remotely located relative to the processor 102, and these remote memories can be connected to the terminal via a network. Examples of such networks include, but are not limited to, the Internet, corporate intranets, local area networks, mobile communication networks, and combinations thereof.
[0047] The transmission device 106 is used to receive or send data via a network. This network includes a wireless network provided by the terminal's communication provider. In one example, the transmission device 106 includes a Network Interface Controller (NIC), which can connect to other network devices via a base station to communicate with the Internet. In another example, the transmission device 106 can be a Radio Frequency (RF) module used for wireless communication with the Internet.
[0048] This embodiment provides a method for determining the boundary of a UV shell. Figure 2 This is a flowchart of a method for determining the boundary of a UV shell according to an embodiment of this application, as shown below. Figure 2 As shown, the process includes the following steps:
[0049] Step S210: Obtain the UV coordinates of the skinned animation.
[0050] Specifically, UV coordinates constitute a UV map. A skinned animation corresponds to one or more UV maps. For a single UV map, each triangle of the skinned mesh corresponds to a UV triangle. The adjacency relationship between UV triangles is determined by whether there is a common edge. The set of all adjacent UV triangles is called the UV shell.
[0051] Step S220: Sort the UV coordinates according to their coordinate values.
[0052] Specifically, the acquired UV coordinates are sorted according to their coordinate values. For example, the sorting can be done by ordering the UV coordinate values from largest to smallest, or by ordering the UV coordinate values from smallest to largest.
[0053] Step S230: Remove duplicates from the sorted UV coordinates to generate duplicated UV coordinates.
[0054] Specifically, the UV coordinates, which are sorted according to their coordinate values, are deduplicated to generate duplicate UV coordinates.
[0055] Step S240: Determine the boundary of the UV shell based on the deduplicated UV coordinates.
[0056] Specifically, based on the deduplicated UV coordinates, the vertex coordinate index of the UV triangle is updated; the number of times each UV edge is referenced by the UV triangle is retrieved; and the boundary of the UV shell is determined based on the number of references.
[0057] In this embodiment, the UV coordinates are sorted according to their coordinate values, and then duplicate UV coordinates are removed from the sorted UV coordinates to generate duplicate UV coordinates. The boundary of the UV shell is determined based on the duplicate UV coordinates. When determining the boundary of the UV shell by the reference count of the UV triangle sides, duplicate UV coordinates are removed, thereby solving the problem of inaccurate boundary determination of the UV shell in the prior art.
[0058] In some embodiments, determining the boundary of the UV shell based on the number of references includes: determining the UV edge with a reference count of 1 as the boundary of the UV shell.
[0059] In some of these embodiments, the UV shell is the area enclosed by the boundary of the UV shell.
[0060] In some embodiments, deduplication of the sorted UV coordinates is performed to generate deduplicated UV coordinates, including: comparing the distance between adjacent groups of UV coordinates in turn according to the sorted UV coordinates; when the distance between adjacent groups of UV coordinates meets a preset value, marking the latter group of UV coordinates in the adjacent groups as redundant UV coordinates, updating the coordinate value of the former group of UV coordinates in the adjacent groups to the average value of the coordinate values of the two groups of UV coordinates; and deleting redundant UV coordinates.
[0061] In some embodiments, the UV coordinates range from 0 to 1, and the preset value ranges from 10. -6 Up to 10 -8 .
[0062] The embodiments of this application will be described and illustrated below through specific examples.
[0063] Figure 3 This is a flowchart of a method for determining the boundary of a UV shell according to a specific embodiment of this invention, as shown below. Figure 3 As shown, the method for determining the boundary of a UV shell includes the following steps:
[0064] Step S310: Sort all UV coordinates according to the size of their coordinate values.
[0065] Step S320: Compare the distances of adjacent UV coordinates in turn; if the deduplication condition is met, mark the latter set of UV coordinates as redundant UV coordinates, and update the value of the former set of coordinates to the average value of the two sets of coordinates.
[0066] Specifically, assuming that two adjacent UV coordinates are (u0, v0) and (u1, v1) respectively, δ is a threshold (usually 10). -6 ~10 -8 When the UV coordinates satisfy the condition ||(u0-u1) 2 +(v0-v1) 2 When || < δ, the two UV coordinates are considered to be duplicate UV coordinates, and these two UV coordinates are merged into one. in, For example, (u1, v1) can be marked as redundant UV coordinates, and (u0, v0) can be updated to the average of the two sets of coordinates. Deduplicating UV coordinates requires calculating for any given UV coordinate, which has a time complexity of O(n(n-1)). To improve computational efficiency, we first sort all UV coordinates by their numerical values, which has a time complexity of O(nlogn), and then compare all adjacent pairs of coordinates, which has a time complexity of O(n-1).
[0067] Step S330: Delete redundant UV coordinates and update the vertex coordinate index of the UV triangle.
[0068] Specifically, based on the judgment result of step S320, redundant UV coordinates are deleted and the index of the UV triangle is updated.
[0069] Step S340: Traverse each UV triangle and retrieve the number of times each UV edge is referenced by the UV triangle.
[0070] Specifically, if the UV edge is e i If the number of references is c, then the set S = {(e i ,c)}. Traverse all UV triangles and add each UV edge to the set. If set S does not contain UV edge e i Then e i Add it to S and set its exponent to 1, creating a new set S′, where S′ = S∪{(e i ,1)}. If set S already contains UV edge e i Then e i The corresponding element is updated to (e i ,c)→(e i (c+1). Determine the UV edge e based on the reference count of each edge in the set. i Whether it is located on the UV shell boundary. All UV edges located on the UV shell boundary are called boundary edges, and the area enclosed by all boundary edges is the UV shell.
[0071] In step S350, all UV edges with a reference count of 1 are boundary edges, and the area enclosed by these boundary edges is the UV shell.
[0072] Specifically, based on the reference count of each edge within the set, it is determined whether the UV edge ei lies on the UV shell boundary. All UV edges located on the UV shell boundary are called boundary edges, and the region enclosed by all boundary edges is the UV shell.
[0073] In this specific embodiment, the UV coordinates are sorted according to their coordinate values, and then duplicate UV coordinates are removed from the sorted UV coordinates to generate duplicate UV coordinates. The boundary of the UV shell is determined based on the duplicate UV coordinates. When determining the boundary of the UV shell by the reference count of the UV triangle sides, duplicate UV coordinates are removed, thereby solving the problem of inaccurate boundary determination of the UV shell in the prior art.
[0074] Figure 4 This is a flowchart of another method for determining the boundary of a UV shell according to this specific embodiment, as shown below. Figure 4 As shown, the method for determining the boundary of a UV shell includes the following steps:
[0075] Step S410: Sort all UVs according to their coordinate values.
[0076] Step S420: Traverse all adjacent UV coordinates.
[0077] Step S430: Determine if the distance is less than the threshold; if yes, proceed to step S440; otherwise, proceed to step S420.
[0078] Specifically, it determines whether the distance between the UV coordinates of two adjacent groups is less than a threshold.
[0079] Step S440: Mark as redundant coordinates.
[0080] Specifically, if the distance between two adjacent UV coordinate groups is less than a threshold, the latter UV coordinate group is marked as redundant.
[0081] Step S450: Determine if the loop has ended; if yes, proceed to step S460; if no, proceed to step S420.
[0082] Step S460: Delete redundant coordinates and update the UV triangle index.
[0083] Step S470: Traverse the UV triangle and retrieve the boundary edges.
[0084] In step S480, all boundary edges form the boundary of the UV shell.
[0085] Step S490, End.
[0086] In this specific embodiment, the UV coordinates are sorted according to their coordinate values, and then duplicate UV coordinates are removed from the sorted UV coordinates to generate duplicate UV coordinates. The boundary of the UV shell is determined based on the duplicate UV coordinates. When determining the boundary of the UV shell by the reference count of the UV triangle sides, duplicate UV coordinates are removed, thereby solving the problem of inaccurate boundary determination of the UV shell in the prior art.
[0087] It should be noted that the steps shown in the above process or in the flowchart of the accompanying figures can be executed in a computer system such as a set of computer-executable instructions, and although a logical order is shown in the flowchart, in some cases the steps shown or described may be executed in a different order than that shown here.
[0088] This embodiment also provides a boundary determination device for a UV shell, which is used to implement the above embodiments and preferred embodiments; details already described will not be repeated. The terms "module," "unit," "subunit," etc., used below can refer to combinations of software and / or hardware that implement a predetermined function. Although the device described in the following embodiments is preferably implemented in software, hardware implementation, or a combination of software and hardware, is also possible and contemplated.
[0089] Figure 5 This is a structural block diagram of a UV shell boundary determination device according to an embodiment of this application, as shown below. Figure 5 As shown, the device includes:
[0090] Module 510 is used to obtain the UV coordinates of the skinned animation;
[0091] The sorting module 520 is used to sort the UV coordinates according to their coordinate values.
[0092] The generation module 530 is used to remove duplicates from the sorted UV coordinates and generate duplicated UV coordinates.
[0093] The determination module 540 is used to determine the boundary of the UV shell based on the deduplicated UV coordinates.
[0094] It should be noted that the above modules can be functional modules or program modules, and can be implemented through software or hardware. For modules implemented through hardware, the above modules can reside in the same processor; or the above modules can be located in different processors in any combination.
[0095] This embodiment also provides an electronic device including a memory and a processor, the memory storing a computer program and the processor being configured to run the computer program to perform the steps in any of the above method embodiments.
[0096] Optionally, the electronic device may further include a transmission device and an input / output device, wherein the transmission device is connected to the processor and the input / output device is connected to the processor.
[0097] Optionally, in this embodiment, the processor can be configured to perform the following steps via a computer program:
[0098] S1, obtain the UV coordinates of the skinned animation;
[0099] S2, Sort the UV coordinates according to their coordinate values;
[0100] S3, remove duplicates from the sorted UV coordinates to generate duplicated UV coordinates;
[0101] S4. Determine the boundary of the UV shell based on the deduplicated UV coordinates.
[0102] It should be noted that the specific examples in this embodiment can refer to the examples described in the above embodiments and optional implementations, and will not be repeated in this embodiment.
[0103] Furthermore, in conjunction with the UV shell boundary determination method provided in the above embodiments, this embodiment can also provide a storage medium for implementation. The storage medium stores a computer program; when executed by a processor, the computer program implements the steps of any of the UV shell boundary determination methods in the above embodiments.
[0104] It should be understood that the specific embodiments described herein are merely illustrative of the application and not intended to limit it. All other embodiments derived by those skilled in the art based on the embodiments provided in this application without inventive effort are within the scope of protection of this application.
[0105] Obviously, the accompanying drawings are merely some examples or embodiments of this application. Those skilled in the art can apply this application to other similar situations based on these drawings without any creative effort. Furthermore, it is understood that although the work done in this development process may be complex and lengthy, for those skilled in the art, certain design, manufacturing, or production modifications made based on the technical content disclosed in this application are merely conventional technical means and should not be considered as insufficient disclosure of this application.
[0106] The term "embodiment" in this application refers to a specific feature, structure, or characteristic described in connection with an embodiment that may be included in at least one embodiment of this application. The appearance of this phrase in various places in the specification does not necessarily imply the same embodiment, nor does it imply that it is mutually exclusive with or independent of other embodiments. It will be clearly or implicitly understood by those skilled in the art that the embodiments described in this application may be combined with other embodiments without conflict.
[0107] The embodiments described above are merely illustrative of several implementation methods of this application, and while the descriptions are relatively specific and detailed, they should not be construed as limiting the scope of patent protection. It should be noted that those skilled in the art can make various modifications and improvements without departing from the concept of this application, and these all fall within the scope of protection of this application. Therefore, the scope of protection of this application should be determined by the appended claims.
Claims
1. A method for determining the boundary of a UV shell, characterized in that, The method includes: Obtain the UV coordinates of the skinned animation; The UV coordinates are sorted according to their coordinate values. The sorted UV coordinates are deduplicated to generate duplicated UV coordinates. The boundary of the UV shell is determined based on the deduplicated UV coordinates; The process of deduplicating the sorted UV coordinates to generate duplicate UV coordinates includes: Based on the sorted UV coordinates, compare the distances between adjacent groups of UV coordinates in turn; When the distance between the UV coordinates of two adjacent groups meets the preset value, the UV coordinates of the latter group in the two adjacent groups are marked as redundant UV coordinates, and the coordinate values of the UV coordinates of the former group in the two adjacent groups are updated to the average value of the coordinate values of the two groups of UV coordinates. Delete the redundant UV coordinates.
2. The method for determining the boundary of the UV shell according to claim 1, characterized in that, Determining the boundary of the UV shell based on the deduplicated UV coordinates includes: Update the vertex coordinate index of the UV triangle based on the deduplicated UV coordinates; Retrieve the number of times each UV edge is referenced by the UV triangle; The boundary of the UV shell is determined based on the number of times it is referenced.
3. The method for determining the boundary of the UV shell according to claim 2, characterized in that, Determining the boundary of the UV shell based on the number of references includes: The UV edge with a reference count of 1 is determined as the boundary of the UV shell.
4. The method for determining the boundary of the UV shell according to claim 3, characterized in that, The UV shell is the area enclosed by the boundary of the UV shell.
5. The method for determining the boundary of the UV shell according to claim 4, characterized in that, The UV coordinates range from 0 to 1, and the preset value ranges from 10. -6 Up to 10 -8 .
6. A boundary determination device for a UV shell, characterized in that, The device includes: The acquisition module is used to obtain the UV coordinates of the skinned animation; The sorting module is used to sort the UV coordinates according to their coordinate values. The generation module is used to deduplicate the sorted UV coordinates and generate duplicate UV coordinates. The determination module is used to determine the boundary of the UV shell based on the deduplicated UV coordinates; The generation module includes: The comparison unit is used to compare the distance between adjacent UV coordinates in turn based on the sorted UV coordinates; The update unit is used to mark the latter group of UV coordinates in the two adjacent groups as redundant UV coordinates and update the coordinate value of the former group of UV coordinates in the two adjacent groups to the average value of the coordinate values of the two groups of UV coordinates when the distance between the two adjacent groups meets the preset value. The deletion unit is used to delete the redundant UV coordinates.
7. An electronic device comprising a memory and a processor, characterized in that, The memory stores a computer program, and the processor is configured to run the computer program to perform the boundary determination method for the UV shell according to any one of claims 1 to 5.
8. A computer-readable storage medium having a computer program stored thereon, characterized in that, When the computer program is executed by the processor, it implements the steps of the UV shell boundary determination method according to any one of claims 1 to 5.