Yuliang commited on
Commit
28cd669
1 Parent(s): 07dffae

Update lib/dataset/mesh_util.py

Browse files

Fix a important bug which may lead to wrong normal vec

Files changed (1) hide show
  1. lib/dataset/mesh_util.py +1 -0
lib/dataset/mesh_util.py CHANGED
@@ -401,6 +401,7 @@ def cal_sdf_batch(verts, faces, cmaps, vis, points):
401
  :, None]).sum(1).unsqueeze(0).ge(1e-1)
402
  pts_norm = (closest_normals*bary_weights[:, :, None]).sum(
403
  1).unsqueeze(0) * torch.tensor([-1.0, 1.0, -1.0]).type_as(normals)
 
404
  pts_dist = torch.sqrt(residues) / torch.sqrt(torch.tensor(3))
405
 
406
  pts_signs = 2.0 * (check_sign(verts, faces[0], points).float() - 0.5)
 
401
  :, None]).sum(1).unsqueeze(0).ge(1e-1)
402
  pts_norm = (closest_normals*bary_weights[:, :, None]).sum(
403
  1).unsqueeze(0) * torch.tensor([-1.0, 1.0, -1.0]).type_as(normals)
404
+ pts_norm = F.normalize(pts_norm, dim=2)
405
  pts_dist = torch.sqrt(residues) / torch.sqrt(torch.tensor(3))
406
 
407
  pts_signs = 2.0 * (check_sign(verts, faces[0], points).float() - 0.5)