Open bychen7 opened 1 year ago
HI @blackmagicianZ,
triangle_table
enumerates the standard marching tetrahedra cases. Based on the sign of the SDF in each tet-corner there's a total of 4^2 =16 (4 corners, 2 signs) that the level-set surface can pass trough the tetrahedra. In some cases the surface is a triangle, and in some cases a quad. The quad cases result in 2 triangles, as indicated by the num_triangles_table
. The values in triangle_table
indices the tet-edge where surface vertices are inserted, in the order indicated by base_tet_edges
.
There's a picture of the marching tet cases here (reduced to 8 symmetric cases): https://daac.hpc.mil/gettingStarted/images/MarchingTets.gif
Your intuition for for base_tet_edges
is correct, just that triangle_table
index tet-edges and not tet-vertices. That's because triangle/surface vertices are inserted where an edge intersects the level-set (SDF=0).
@JHnvidia Thank you for your response. I roughly understand that the first row [1, 0, 2, -1, -1, -1] in the triangle_table represents selecting the three edges (0,1), (0,2), and (0,3) from base_tet_edges, and [2, 0, 1, -1, -1, -1] is the symmetric case. How was the order of 1, 0, and 2 determined in the first row? Can it be any order?
The order is mostly flexible, but all tables are connected and must be consistent with a right handed coordinate system and counter clockwise winding rules.
base_tet_edges
provided you re-index triangle_table
to be consistent with the Figure I linked in the previous post.triangle_table
provided you don't change winding. Each tuple of 6 values is two triangles, with -1 indicating N/A. Assuming your example [(1, 0, 2), (-1, -1, -1)]
above, you could re-order it as [(2, 1, 0), (-1, -1, -1)]
, for example. Note that the symmetric case changes the winding ([2, 0, 1]
is not a simple shift) and therefore flips which side of the triangle is considered front and back.@JHnvidia Thank you for your patient response, but I still don't understand why it is necessary to comply with the right-hand coordinate system and counterclockwise winding rule, and I haven't found a symmetrical pattern. How was triangle_table
written row by row according to the image in the link?
Hi @bychen7, the table is constructed in such a way that all extracted triangles have their normal points facing outward, with the assumption that the negative SDF represents the "inside" of the object. You can work with a different convention, but it's crucial to ensure that the windings are consistent, and the normals are correct when passing the mesh into diff-render. Hope this answers your question!
Hi @JHnvidia, can you give me the correct URL for marching test cases? Before one is https://daac.hpc.mil/gettingStarted/images/MarchingTets.gif, but I cannot connect to this URL.
Thank you for your code. Recently, while studying your work on the implementation of DMTet code, I have some questions and would appreciate your response. Specifically:
https://github.com/NVlabs/nvdiffrec/blob/e7f2181b8a60eb8fedcdb4ad4d05bff3c0cf9bc1/geometry/dmtet.py#L23
triangle_table
16x6 matrix? I am not clear on the specific meaning of each number. My understanding is that a tetrahedron has four vertices, four faces and six edges, but I am not able to match them up.https://github.com/NVlabs/nvdiffrec/blob/e7f2181b8a60eb8fedcdb4ad4d05bff3c0cf9bc1/geometry/dmtet.py#L42
num_triangles_table
represent the number of faces in each row of the triangle_table?https://github.com/NVlabs/nvdiffrec/blob/e7f2181b8a60eb8fedcdb4ad4d05bff3c0cf9bc1/geometry/dmtet.py#L43
base_tet_edges
, 0, 1, 2, and 3 represent the vertices of the tetrahedron, and (0,1) represents an edge. There are a total of six edges. Is my understanding correct? If so, I am unsure why there are numbers 4 and 5 in thetriangle_table
.