pytorch3d icon indicating copy to clipboard operation
pytorch3d copied to clipboard

Wrong results in pytorch3d._C.point_face_dist_forward

Open RickyYXY opened this issue 3 years ago • 0 comments

🐛 Unexpected behaviors

When I wanted to calculate the distance from points to SMPL mesh, I found that the result is almost wrong, far from the result calculated by igl.signed_distance

Instructions To Reproduce the Issue:

I use the function pytorch3d._C.point_face_dist_forward

dists, f_id = _C.point_face_dist_forward(
        pts, torch.tensor([0], device=pts.device).long(),
        verts[faces], torch.tensor([0], device=pts.device).long(),
        pts.shape[0], 5e-10,
    )
dists = torch.sqrt(dists)

where pts is a Nx3 tensor, verts is a Vx3 tensor, faces(index for 3 vertices) is a Fx3 tensor. They are from a SMPL body model. The results is wrong and different from

dists, f_id , _= igl.signed_distance(
            pts.cpu().numpy(),
            verts.cpu().numpy(),
            faces.cpu().numpy(),
        )

Two distance results are different after abs(), and the same for two f_id. I think it must be wrong somewhere, is the _C.point_face_dist_forward function wrong???

My pytorch is 1.8.0, and pytorch3d 0.6.2

RickyYXY avatar Oct 10 '22 06:10 RickyYXY