Skip to content

Commit

Permalink
Utils for clipping mesh faces partially behind the image plane
Browse files Browse the repository at this point in the history
Summary:
Instead of culling faces behind the camera, partially clip them if they intersect with the image plane.

This diff implements the utils functions for clipping.

There are 4 cases for the mesh faces which are all handled:

```
Case 1: the triangle is completely in front of the clipping plane (it is left
        unchanged)
Case 2: the triangle is completely behind the clipping plane (it is culled)
Case 3: the triangle has exactly two vertices behind the clipping plane (it is
        clipped into a smaller triangle)
Case 4: the triangle has exactly one vertex behind the clipping plane (it is clipped
        into a smaller quadrilateral and divided into two triangular faces)
```

Reviewed By: jcjohnson

Differential Revision: D23108673

fbshipit-source-id: 550a8b6a982d06065dff10aba10d47e8b144ae52
  • Loading branch information
nikhilaravi authored and facebook-github-bot committed Feb 6, 2021
1 parent db6fbfa commit 23279c5
Show file tree
Hide file tree
Showing 3 changed files with 953 additions and 0 deletions.
1 change: 1 addition & 0 deletions pytorch3d/renderer/mesh/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
# Copyright (c) Facebook, Inc. and its affiliates. All rights reserved.


from .clip import ClipFrustum, ClippedFaces, clip_faces
from .rasterize_meshes import rasterize_meshes
from .rasterizer import MeshRasterizer, RasterizationSettings
from .renderer import MeshRenderer
Expand Down
Loading

0 comments on commit 23279c5

Please sign in to comment.