Uvmap a mesh (provided as vertices and triangles) using xatlas. Args: vertices: (n, 3) float triangle_ids: (m, 3) int Returns: vmapping: (n,), uint32, contains the original vertex index for each new vertex. indices:
(
vertices: np.ndarray,
triangle_ids: np.ndarray,
)
| 875 | |
| 876 | |
| 877 | def remesh( |
| 878 | vertices: np.ndarray, |
| 879 | triangle_ids: np.ndarray, |
| 880 | ) -> T.Dict[str, T.Any]: |
| 881 | """ |
| 882 | Uvmap a mesh (provided as vertices and triangles) using xatlas. |
| 883 | |
| 884 | Args: |
| 885 | vertices: |
| 886 | (n, 3) float |
| 887 | triangle_ids: |
| 888 | (m, 3) int |
| 889 | |
| 890 | Returns: |
| 891 | vmapping: |
| 892 | (n,), uint32, contains the original vertex index for each new vertex. |
| 893 | indices: |
| 894 | (num_triangles, 3), uint32, contains the vertex indices of the new triangles. |
| 895 | uvs: |
| 896 | (n, 2), contains texture coordinates of the new vertices. |
| 897 | """ |
| 898 | |
| 899 | vmapping, indices, uvs = xatlas.parametrize( |
| 900 | vertices, |
| 901 | triangle_ids, |
| 902 | ) |
| 903 | # `vmapping` contains the original vertex index for each new vertex, (n,), type uint32. |
| 904 | # `indices` contains the vertex indices of the new triangles, (num_triangles, 3), type uint32. |
| 905 | # `uvs` contains texture coordinates of the new vertices, (n, 2), type float32. |
| 906 | |
| 907 | return dict( |
| 908 | vmapping=vmapping, |
| 909 | indices=indices, |
| 910 | uvs=uvs, |
| 911 | ) |
| 912 | |
| 913 | |
| 914 | def srgb_to_linear(x: torch.Tensor): |