Stability-AI / stable-fast-3d

SF3D: Stable Fast 3D Mesh Reconstruction with UV-unwrapping and Illumination Disentanglement
https://stable-fast-3d.github.io
Other
1.2k stars 136 forks source link

About quadrilateral remeshed object 's export #22

Closed seongyeong2 closed 3 months ago

seongyeong2 commented 3 months ago

Hello, I'm grateful to have come across such brilliant research.

I'm particularly interested in remeshing and mesh export using UV mapping. It's great that quadrilateral remeshing is possible with a Python package, but it seems the mesh is exported as triangles due to the texture mapping process.

Is there a way to remesh and export a textured mesh with quadrilateral faces?

Thank you.

Banbury commented 3 months ago

The Python script has an option for remeshing with quads. But depending on your model, you might be better off using a something like Houdini for remeshing.

seongyeong2 commented 3 months ago

@Banbury I am aware of and have been using the remeshing with quads, so thank you for that.

What I was referring to, though, is that even when I perform quadrilateral remeshing, the exported mesh gets converted to triangle faces. I’m curious if it’s possible to obtain a mesh composed entirely of quadrilateral faces even after export.

If I’ve missed something, please let me know. Thank you!

Banbury commented 3 months ago

Technically there are only triangles. But Blender (and other modelling software) has a function to convert the triangles to quads after you remeshed it.

seongyeong2 commented 3 months ago

@Banbury

Exactly. I was just curious if there’s any consideration for supporting quadrilateral faces through other methods in the future. In the case of Blender's remesh with quad, there are quite a few limitations since the mesh needs to be manifold.

Banbury commented 3 months ago

'Tris to Quads' in Blender doesn't do a remesh. It just removes the diagonal edge from a quad. So if your mesh is already in quads, 'Tris to Quads' will fix the display, but doesn't change the mesh.

seongyeong2 commented 3 months ago

@Banbury Is there another 'tri to quad' feature? I wasn’t aware of it. Can you tell me where it’s located? 😮

image

Banbury commented 3 months ago

In Edit mode Face/Tris to Quads or press Alt-J.

seongyeong2 commented 3 months ago

@Banbury Thank you so much! I’m learning something new! 😀 By the way, is there a specific Python package for UV unwrapping quadrilateral faces? You seem like an expert, so I wanted to ask.

Banbury commented 3 months ago

I would consider myself a gentlemen amateur 😄. I don't think there is a difference unwrapping tris or quads. Internally a quad is just two triangles. If I have the need to unwrap something programmatically, I use either Blender or Houdini. Houdini is particularly powerful (and free to use), but very difficult to learn.

vork commented 3 months ago

Hi,

glb only supports triangles. As most other formats are a bit of a hassle with external texture files (would require zipping) or material parameter definitions, I opted to only support glb for the demo. But internally, it's a trimesh and can be exported to all supported formats with some minor modifications to run.py

In theory, the UV unwrapping can also be altered to handle quads, but then you need pure quad meshes. Mixing quad/tris is a bit more of a hassle.

seongyeong2 commented 3 months ago

@vork Thank you for the reply. I have one more question, though I’m not sure if it’s okay to ask it here.

After performing quad remesh and unwrap, I noticed that the final mesh's vertices and edges either change in number or value. Is there a way to export the mesh while preserving the topology of the geometry as it was after the remesh process? Or perhaps, I’m wondering if there’s something I might have done incorrectly.

vork commented 3 months ago

The UV unwrapping adds duplicated vertices at the UV seams. This is also due to a constraint by trimesh, which does not support UV face indices. As far as I know, most graphics libraries or mesh formats also do not support it. So this is an expected and required behavior.

seongyeong2 commented 2 months ago

@vork Thank you for your reply. Actually, I met another problem with using remesh. Could you check for this through below link? Thank you for you consideration. :)

https://github.com/vork/PyNanoInstantMeshes/issues/4