Yuliang commited on
Commit
f598b6f
1 Parent(s): d46c752

visualize with normal texture, download with half-colored texture

Browse files
Files changed (1) hide show
  1. apps/infer.py +14 -3
apps/infer.py CHANGED
@@ -418,13 +418,24 @@ def generate_model(in_path, model_type):
418
  mesh_pr.faces_packed().detach().squeeze(0).cpu(),
419
  process=False, maintains_order=True
420
  )
 
 
 
 
 
 
 
 
421
 
422
- # without front texture
423
- final_colors = (mesh_pr.verts_normals_padded().squeeze(
424
  0).detach().cpu() + 1.0) * 0.5 * 255.0
425
- final.visual.vertex_colors = final_colors
 
426
  final.export(
427
  f"{config_dict['out_dir']}/{cfg.name}/obj/{data['name']}_refine.obj")
 
 
428
  final.export(
429
  f"{config_dict['out_dir']}/{cfg.name}/obj/{data['name']}_refine.glb")
430
 
 
418
  mesh_pr.faces_packed().detach().squeeze(0).cpu(),
419
  process=False, maintains_order=True
420
  )
421
+
422
+ # only with front texture
423
+ tex_colors = query_color(
424
+ mesh_pr.verts_packed().detach().squeeze(0).cpu(),
425
+ mesh_pr.faces_packed().detach().squeeze(0).cpu(),
426
+ in_tensor["image"],
427
+ device=device,
428
+ )
429
 
430
+ # full normal textures
431
+ norm_colors = (mesh_pr.verts_normals_padded().squeeze(
432
  0).detach().cpu() + 1.0) * 0.5 * 255.0
433
+
434
+ final.visual.vertex_colors = tex_colors
435
  final.export(
436
  f"{config_dict['out_dir']}/{cfg.name}/obj/{data['name']}_refine.obj")
437
+
438
+ final.visual.vertex_colors = norm_colors
439
  final.export(
440
  f"{config_dict['out_dir']}/{cfg.name}/obj/{data['name']}_refine.glb")
441