SIGMitch commited on
Commit
ac3cfa0
·
verified ·
1 Parent(s): 6e76a58
Files changed (1) hide show
  1. app.py +15 -6
app.py CHANGED
@@ -19,7 +19,7 @@ from src.utils.camera_util import (
19
  get_zero123plus_input_cameras,
20
  get_circular_camera_poses,
21
  )
22
- from src.utils.mesh_util import save_obj, save_glb
23
  from src.utils.infer_util import remove_background, resize_foreground, images_to_video
24
 
25
  import tempfile
@@ -228,15 +228,24 @@ def make3d(images):
228
  # get mesh
229
  mesh_out = model.extract_mesh(
230
  planes,
231
- use_texture_map=False,
232
  **infer_config,
233
  )
 
 
 
 
 
 
 
 
 
234
 
235
- vertices, faces, vertex_colors = mesh_out
236
- vertices = vertices[:, [1, 2, 0]]
237
 
238
- save_glb(vertices, faces, vertex_colors, mesh_glb_fpath)
239
- save_obj(vertices, faces, vertex_colors, mesh_fpath)
240
 
241
  print(f"Mesh saved to {mesh_fpath}")
242
 
 
19
  get_zero123plus_input_cameras,
20
  get_circular_camera_poses,
21
  )
22
+ from src.utils.mesh_util import save_obj, save_glb, save_obj_with_mtl
23
  from src.utils.infer_util import remove_background, resize_foreground, images_to_video
24
 
25
  import tempfile
 
228
  # get mesh
229
  mesh_out = model.extract_mesh(
230
  planes,
231
+ use_texture_map=True,
232
  **infer_config,
233
  )
234
+ vertices, faces, uvs, mesh_tex_idx, tex_map = mesh_out
235
+ save_obj_with_mtl(
236
+ vertices.data.cpu().numpy(),
237
+ uvs.data.cpu().numpy(),
238
+ faces.data.cpu().numpy(),
239
+ mesh_tex_idx.data.cpu().numpy(),
240
+ tex_map.permute(1, 2, 0).data.cpu().numpy(),
241
+ mesh_fpath,
242
+ )
243
 
244
+ #vertices, faces, vertex_colors = mesh_out
245
+ #vertices = vertices[:, [1, 2, 0]]
246
 
247
+ #save_glb(vertices, faces, vertex_colors, mesh_glb_fpath)
248
+ #save_obj(vertices, faces, vertex_colors, mesh_fpath)
249
 
250
  print(f"Mesh saved to {mesh_fpath}")
251