Commit Graph

8 Commits

Author SHA1 Message Date
Patrick Labatut af93f34834 License lint codebase
Summary: License lint codebase

Reviewed By: theschnitz

Differential Revision: D29001799

fbshipit-source-id: 5c59869911785b0181b1663bbf430bc8b7fb2909
2021-06-22 03:45:27 -07:00
Jeremy Reizenstein 31c448a95d Test gltf texture without renderer.
Summary:
Change the cow gltf loading test to validate the texture values and not to validate the renderer output because it has an unstable pixel.

Also a couple of lints.

Reviewed By: patricklabatut

Differential Revision: D29131260

fbshipit-source-id: 5e11f066a2a638588aacb09776cc842173ef669f
2021-06-21 08:11:36 -07:00
Nikhila Ravi c75ca04cf7 Bug fix in rendering clipped meshes
Summary:
There was a bug when `z_clip_value` is not None but there are no faces which are actually visible in the image due to culling.  In `rasterize_meshes.py` a function `convert_clipped_rasterization_to_original_faces` is called to convert the clipped face indices etc back to the unclipped versions, but the case where there is no clipping was not handled correctly.

Fixes Github Issue #632

Reviewed By: bottler

Differential Revision: D29116150

fbshipit-source-id: fae82a0b4848c84b3ed7c7b04ef5c9848352cf5c
2021-06-15 07:51:12 -07:00
Nikhila Ravi a0f79318c5 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
2021-06-11 14:33:40 -07:00
Jeremy Reizenstein c18ee9d40a lint fixes
Summary: Lint after recent changes.

Reviewed By: nikhilaravi

Differential Revision: D27682328

fbshipit-source-id: 285d159010d886e4e97902995adbdff875fd3c19
2021-04-12 19:10:18 -07:00
Rong Rong (AI Infra) 1216b5765a Extract finding directories for test data
Summary: Make common functions for finding directories where test data is found, instead of lots of tests using their own `__file__`  while trying to get ./tests/data and the tutorials data.

Reviewed By: nikhilaravi

Differential Revision: D27633701

fbshipit-source-id: 1467bb6018cea16eba3cab097d713116d51071e9
2021-04-08 20:03:04 -07:00
Nikhila Ravi 340662e98e CUDA/C++ Rasterizer updates to handle clipped faces
Summary:
- Updated the C++/CUDA mesh rasterization kernels to handle the clipped faces. In particular this required careful handling of the distance calculation for faces which are cut into a quadrilateral by the image plane and then split into two sub triangles i.e. both sub triangles can't be part of the top K faces.
- Updated `rasterize_meshes.py` to use the utils functions to clip the meshes and convert the fragments back to in terms of the unclipped mesh
- Added end to end tests

Reviewed By: jcjohnson

Differential Revision: D26169685

fbshipit-source-id: d64cd0d656109b965f44a35c301b7c81f451cfa0
2021-02-08 14:32:39 -08:00
Nikhila Ravi 23279c5f1d Utils for clipping mesh faces partially behind the image plane
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
2021-02-05 18:30:15 -08:00