Culling to frustrum bug fix

Summary:
When `z_clip_value = None` and faces are outside the view frustum the shape of one of the tensors in `clip.py` is incorrect.

`faces_num_clipped_verts` should be (F,) but it was (F,3).  Added a new test to ensure this case is handled.

Reviewed By: bottler

Differential Revision: D29051282

fbshipit-source-id: 5f4172ba4d4a75d928404dde9abf48aef18c68bd
This commit is contained in:
Nikhila Ravi
2021-06-11 14:33:01 -07:00
committed by Facebook GitHub Bot
parent ef16253953
commit a0f79318c5
3 changed files with 33 additions and 12 deletions

View File

@@ -372,7 +372,7 @@ def clip_faces(
# (F) dim tensor containing the number of clipped vertices in each triangle
faces_num_clipped_verts = faces_clipped_verts.sum(1)
else:
faces_num_clipped_verts = torch.zeros([F, 3], device=device)
faces_num_clipped_verts = torch.zeros([F], device=device)
# If no triangles need to be clipped or culled, avoid unnecessary computation
# and return early