142 Commits

Author SHA1 Message Date
Nikhila Ravi
90f6a005b0 Tutorials textures updates and fix bug in extending meshes with uv textures
Summary:
Found a bug in extending textures with vertex uv coordinates. This was due to the padded -> list conversion of vertex uv coordinates i.e.                 The number of vertices in the mesh and in verts_uvs can differ
e.g. if a vertex is shared between 3 faces, it can
have up to 3 different uv coordinates. Therefore we cannot convert directly from padded to list using _num_verts_per_mesh

Reviewed By: bottler

Differential Revision: D23233595

fbshipit-source-id: 0c66d15baae697ead0bdc384f74c27d4c6539fc9
2020-08-21 19:20:09 -07:00
Nikhila Ravi
d330765847 Website and docs updates
Summary:
- Added sbranson's fit mesh tutorial to the website
- Updated rendering docs with info about texturing and new shader types.

TODO:
- add pointcloud rendering tutorial to the website as well (https://github.com/facebookresearch/pytorch3d/blob/master/docs/tutorials/render_colored_points.ipynb)
- docs for camera
- update some tutorials which depended on the Textures from structures.

Reviewed By: gkioxari

Differential Revision: D23143977

fbshipit-source-id: 6843c9bf3ce11115c459c64da5b0ad778dc92177
2020-08-21 19:17:16 -07:00
Georgia Gkioxari
57a22e7306 camera refactoring
Summary:
Refactor cameras
* CamerasBase was enhanced with `transform_points_screen` that transforms projected points from NDC to screen space
* OpenGLPerspective, OpenGLOrthographic -> FoVPerspective, FoVOrthographic
* SfMPerspective, SfMOrthographic -> Perspective, Orthographic
* PerspectiveCamera can optionally be constructred with screen space parameters
* Note on Cameras and coordinate systems was added

Reviewed By: nikhilaravi

Differential Revision: D23168525

fbshipit-source-id: dd138e2b2cc7e0e0d9f34c45b8251c01266a2063
2020-08-20 22:22:06 -07:00
mlygao@devgpu002.atn3.facebook.com
9242e7e65d ShapeNetCore & R2N2 tutorial
Summary: Tutorial for ShapeNetCore & R2N2.

Reviewed By: gkioxari

Differential Revision: D22916882

fbshipit-source-id: 752742be87f44919164ec7eafcc9c09c17a0f8a3
2020-08-20 17:57:06 -07:00
Anton Troynikov
370f1c380c Fix 404 link in Renderer Doc (#330)
Summary:
Because of the way Sphinx was parsing this link in Markdown, the link wasn't working properly. This should fix it.

Pull Request resolved: https://github.com/facebookresearch/pytorch3d/pull/330

Test Plan: Tested via local Sphinx.

Reviewed By: nikhilaravi

Differential Revision: D23244163

Pulled By: atroyn

fbshipit-source-id: 019712a841d76391a5210dcd98c77a822947204a
2020-08-20 17:23:30 -07:00
Nikhila Ravi
8e9ff15faf datasets.md (documentation for datasets)
Summary: documentation for datasets

Reviewed By: bottler, gkioxari

Differential Revision: D22992266

fbshipit-source-id: 44aaa8227af04c1baa5ea6c31ba131dea2b9675b
2020-08-14 11:27:50 -07:00
Nikhila Ravi
a3932960b3 Texturing API updates
Summary:
A fairly big refactor of the texturing API with some breaking changes to how textures are defined.

Main changes:
- There are now 3 types of texture classes: `TexturesUV`, `TexturesAtlas` and `TexturesVertex`. Each class:
   - has a `sample_textures` function which accepts the `fragments` from rasterization and returns `texels`. This means that the shaders will not need to know the type of the mesh texture which will resolve several issues people were reporting on GitHub.
  -  has a `join_batch` method for joining multiple textures of the same type into a batch

Reviewed By: gkioxari

Differential Revision: D21067427

fbshipit-source-id: 4b346500a60181e72fdd1b0dd89b5505c7a33926
2020-07-29 16:11:23 -07:00
Georgia Gkioxari
42b5b96595 remove composite params from tutorials
Summary: Remove composite params from tutorial

Reviewed By: nikhilaravi

Differential Revision: D22809242

fbshipit-source-id: e5ed4e93fc892baf74e3a464119f0d11973423c3
2020-07-28 22:21:20 -07:00
Steve Branson
9a5341bde3 Add tutorial for fitting textured mesh to multi-view images
Summary: Tutorial showing how to create a synthetic dataset by rendering a cow from multiple views, fit a mesh using a differential silhouette renderer, then fit a mesh using an RGB renderer.

Reviewed By: nikhilaravi

Differential Revision: D22513859

fbshipit-source-id: 24bdaac4ebec6dd01f98e2f5c702065f9335ff33
2020-07-23 12:14:45 -07:00
Georgia Gkioxari
3d7dea58e1 remove unused params + cubify note
Summary:
This diff
* removes the unused compositing params
* adds a note describing cubify

Reviewed By: nikhilaravi

Differential Revision: D22426191

fbshipit-source-id: e8aa32040bb594e1dfd7d6d98e29264feefcec7c
2020-07-09 18:04:06 -07:00
Jeremy Reizenstein
275ddade66 CPU device for tutorials
Reviewed By: nikhilaravi

Differential Revision: D22357376

fbshipit-source-id: c103f9b0c798d4425d642781b5bfbb1a27310270
2020-07-03 08:52:41 -07:00
Jeremy Reizenstein
52979226bc strip output from tutorials
Summary: It's easier to understand code changes if we don't store the output in the notebooks. This is just a run of nbstripout on all the notebooks.

Reviewed By: nikhilaravi

Differential Revision: D22357375

fbshipit-source-id: bffdb426af2f676d448630d717658d609c224811
2020-07-03 08:52:41 -07:00
Luya Gao
b636f2950d Adding datasets.rst to modules
Summary: Adding datasets.rst to modules and update index.rst.

Reviewed By: nikhilaravi

Differential Revision: D22187578

fbshipit-source-id: e70cf49fa276db8a106c67a2edab530b6dba2dee
2020-06-29 13:15:51 -07:00
Nikhila Ravi
17ca6ecd81 allow cameras to be None in rasterizer initialization
Summary: Fix to enable a mesh/point rasterizer to be initialized without having to specify the camera.

Reviewed By: jcjohnson, gkioxari

Differential Revision: D21362359

fbshipit-source-id: 4f84ea18ad9f179c7b7c2289ebf9422a2f5e26de
2020-05-05 22:32:57 -07:00
Jeremy Reizenstein
686c8666d3 version 0.2.0
Summary: Update version number for version 0.2.0.

Reviewed By: nikhilaravi

Differential Revision: D21157358

fbshipit-source-id: 32a5b93e5dc65a31a806a5ce7231f8603fe02e85
2020-04-26 07:18:57 -07:00
Nikhila Ravi
9ef1ee8455 coarse rasterization bug fix
Summary:
Fix a bug which resulted in a rendering artifacts if the image size was not a multiple of 16.
Fix: Revert coarse rasterization to original implementation and only update fine rasterization to reverse the ordering of Y and X axis. This is much simpler than the previous approach!

Additional changes:
- updated mesh rendering end-end tests to check outputs from both naive and coarse to fine rasterization.
- added pointcloud rendering end-end tests

Reviewed By: gkioxari

Differential Revision: D21102725

fbshipit-source-id: 2e7e1b013dd6dd12b3a00b79eb8167deddb2e89a
2020-04-20 14:54:16 -07:00
Nikhila Ravi
474c8b456a remove bin_size from the settings in the tutorials
Summary: Remove `bin_size` and `max_faces_per_pixel` from being specified. This means the coarse-to-fine rasterization will be used by default and will help avoid confusion with the naive version.

Reviewed By: jcjohnson

Differential Revision: D20908905

fbshipit-source-id: c181c88e844d888aa81a36870918307961dc1175
2020-04-08 10:07:36 -07:00
Patrick Labatut
d57daa6f85 Address black + isort fbsource linter warnings
Summary: Address black + isort fbsource linter warnings from D20558374 (previous diff)

Reviewed By: nikhilaravi

Differential Revision: D20558373

fbshipit-source-id: d3607de4a01fb24c0d5269634563a7914bddf1c8
2020-03-29 14:51:02 -07:00
Nikhila Ravi
6d34e1c60d Tutorial updates
Summary:
Add a note about the difference between naive and coarse-to-fine rasterization to all the rendering tutorials.

Update the render pointclouds tutorial to wget the data file.

Reviewed By: gkioxari

Differential Revision: D20575257

fbshipit-source-id: a2806b9452438f97cb754f87e011c6e32e2545e4
2020-03-20 18:26:49 -07:00
Olivia
53599770dd Accumulate points (#4)
Summary:
Code for accumulating points in the z-buffer in three ways:
1. weighted sum
2. normalised weighted sum
3. alpha compositing

Pull Request resolved: https://github.com/fairinternal/pytorch3d/pull/4

Reviewed By: nikhilaravi

Differential Revision: D20522422

Pulled By: gkioxari

fbshipit-source-id: 5023baa05f15e338f3821ef08f5552c2dcbfc06c
2020-03-19 11:23:12 -07:00
Patrick Labatut
c9742d00b0 Enable spelling linter for Markdown, reStructuredText and IPython notebooks
Summary: Enable spelling linter for Markdown, reStructuredText and IPython notebooks under `fbcode/vision/fair`. Apply suggested fixes.

Reviewed By: ppwwyyxx

Differential Revision: D20495298

fbshipit-source-id: 95310c7b51f9fa68ba2aa34ecc39a874da36a75c
2020-03-17 16:33:20 -07:00
Nikhila Ravi
3901dbe4de website updates
Summary:
A few small website updates:

- changed the tutorials to point to the `stable` tag on github so we don't have to update the website each time we want to run them!
- changed the colab button
- re ran notebook cells to update the images for textured meshes

Once these fixes are landed I can build and publish the website.

Reviewed By: bottler

Differential Revision: D20484836

fbshipit-source-id: 603a05e752f631c60d1a3abb9adeb1b9b451ab98
2020-03-17 13:08:21 -07:00
Patrick Labatut
25d2e2c8b7 Use a consistent case for PyTorch3D
Summary: Use a consistent case for PyTorch3D (matching the logo...): replace all occurrences of PyTorch3d with PyTorch3D across the codebase (including documentation and notebooks)

Reviewed By: wanyenlo, gkioxari

Differential Revision: D20427546

fbshipit-source-id: 8c7697f51434c51e99b7fe271935932c72a1d9b9
2020-03-17 12:48:43 -07:00
Jeremy Reizenstein
fa81953380 test_build
Summary: Ensure copyright header consistency and translation unit name uniqueness.

Reviewed By: nikhilaravi

Differential Revision: D20438802

fbshipit-source-id: 9820cfe4c6efab016a0a8589dfa24bb526692f83
2020-03-16 07:54:56 -07:00
Patrick Labatut
3c71ab64cc Remove shebang line when not strictly required
Summary: The shebang line `#!<path to interpreter>` is only required for Python scripts, so remove it on source files for class or function definitions. Additionally explicitly mark as executable the actual Python scripts in the codebase.

Reviewed By: nikhilaravi

Differential Revision: D20095778

fbshipit-source-id: d312599fba485e978a243292f88a180d71e1b55a
2020-03-12 10:39:44 -07:00
Nikhila Ravi
d01e722849 Fix coordinate system conventions in point cloud renderer
Summary:
Applying the changes added for mesh rasterization to ensure that +Y is up and +X is left so that the coordinate system is right handed.

Also updated the diagram in the docs to indicate that (0,0) is in the top left hand corner.

Reviewed By: gkioxari

Differential Revision: D20394849

fbshipit-source-id: cfb7c79090eb1f55ad38b92327a74a70a8dc541e
2020-03-12 07:48:29 -07:00
Georgia Gkioxari
112d32eaf0 Add more DR citations
Summary: Add more DR citations

Reviewed By: nikhilaravi

Differential Revision: D20330205

fbshipit-source-id: 4fb95d422371ae9ff5cdc2693736e36799201477
2020-03-08 14:53:22 -07:00
Jeremy Reizenstein
cf8e667b61 version 0.1.1
Summary: Bumping the version number to 0.1.1 and thereby documenting all the places where the version number currently appears in the code.

Reviewed By: nikhilaravi

Differential Revision: D20067382

fbshipit-source-id: 76a25ed1d4036f51357e4ae3e0f07de32ad114ae
2020-03-07 12:42:43 -08:00
Nikhila Ravi
15c72be444 Fix coordinate system conventions in renderer
Summary:
## Updates

- Defined the world and camera coordinates according to this figure. The world coordinates are defined as having +Y up, +X left and +Z in.

{F230888499}

- Removed all flipping from blending functions.
- Updated the rasterizer to return images with +Y up and +X left.
- Updated all the mesh rasterizer tests
    - The expected values are now defined in terms of the default +Y up, +X left
    - Added tests where the triangles in the meshes are non symmetrical so that it is clear which direction +X and +Y are

## Questions:
- Should we have **scene settings** instead of raster settings?
    - To be more correct we should be [z clipping in the rasterizer based on the far/near clipping planes](https://github.com/ShichenLiu/SoftRas/blob/master/soft_renderer/cuda/soft_rasterize_cuda_kernel.cu#L400) - these values are also required in the blending functions so should we make these scene level parameters and have a scene settings tuple which is available to the rasterizer and shader?

Reviewed By: gkioxari

Differential Revision: D20208604

fbshipit-source-id: 55787301b1bffa0afa9618f0a0886cc681da51f3
2020-03-06 06:51:05 -08:00
Tyler Barron
40be4cf78b Update bundle_adjustment.ipynb (#81)
Summary:
*: Fixed references to colors in the diagram
Pull Request resolved: https://github.com/facebookresearch/pytorch3d/pull/81

Reviewed By: bottler

Differential Revision: D20064048

Pulled By: nikhilaravi

fbshipit-source-id: a70ee446f1223ec900072a2380c75ed95fb4431d
2020-02-24 12:13:55 -08:00
Patrick Labatut
9ca5489107 Fix spelling of "Gouraud"
Summary: Fix spelling of *Gouraud* in [Gouraud shading](https://en.wikipedia.org/wiki/Gouraud_shading).

Reviewed By: nikhilaravi

Differential Revision: D19943547

fbshipit-source-id: 5c016b7b051a7b33a7b68ed5303b642d9e834bbd
2020-02-20 01:11:56 -08:00
Nikhila Ravi
f0dc65110a Shader API more consistent naming
Summary:
Renamed shaders to be prefixed with Hard/Soft depending on if they use a probabalistic blending (Soft) or use the closest face (Hard).

There is some code duplication but I thought it would be cleaner to have separate shaders for each task rather than:
- inheritance (which we discussed previously that we want to avoid)
- boolean (hard/soft) or a string (hard/soft) - new blending functions other than the ones provided would need if statements in the current shaders which might get messy.

Also added a `flat_shading` function and a `FlatShader` - I could make this into a tutorial as it was really easy to add a new shader and it might be a nice showcase.

NOTE: There are a few more places where the naming will need to change (e.g the tutorials) but I wanted to reach a consensus on this before changing it everywhere.

Reviewed By: jcjohnson

Differential Revision: D19761036

fbshipit-source-id: f972f6530c7f66dc5550b0284c191abc4a7f6fc4
2020-02-19 23:16:50 -08:00
Junior Rojas
3ba4398095 Fix typo (#54)
Summary: Pull Request resolved: https://github.com/facebookresearch/pytorch3d/pull/54

Differential Revision: D19951851

Pulled By: gkioxari

fbshipit-source-id: cf41d5806c761639d1efa42a633404b248486c30
2020-02-18 10:15:16 -08:00
Jeremy Reizenstein
8fe65d5f56 Single function to load meshes from OBJs. join_meshes.
Summary:
Create the textures and the Meshes object from OBJ files in a single call.

There is functionality in OBJ files (like normals) which is ignored by this function.

Reviewed By: gkioxari

Differential Revision: D19691699

fbshipit-source-id: e26442ed80ff231b65b17d6c54c9d41e22b4e4a3
2020-02-13 03:38:07 -08:00
Nikhila Ravi
09992a388f Update tutorials for Google Colab
Summary:
Update all colab notebooks to:
- Install pytorch3d using pip install from github.
- Retrieve data using `wget`. I set the wget commands to save the files in the same directory structure as in the PyTorch3d repo so that the rest of the tutorial would work for running locally or on Colab.

This should resolve the issues on GitHub with running the colab notebooks.

Reviewed By: gkioxari

Differential Revision: D19827450

fbshipit-source-id: d7b338597ddfd9a84c24592d4dccd274cae11d05
2020-02-10 19:08:01 -08:00
uzkt
3b1a0741b6 fix small typo in deform_source_mesh_to_target_mesh.ipynb (#34)
Summary:
fixed target object data folder path './data/doplhin'-> './data/dolphin'
Pull Request resolved: https://github.com/facebookresearch/pytorch3d/pull/34

Differential Revision: D19815377

Pulled By: nikhilaravi

fbshipit-source-id: ff17f6aef8d835b11d7803e912a311c7118b03fa
2020-02-10 09:14:09 -08:00
Yannick Soom
ca588a59d7 small typo in deform_source_mesh_to_target_mesh.ipynb (#24)
Summary:
fixed small typo in deform_source_mesh_to_target_mesh.ipynb
Pull Request resolved: https://github.com/facebookresearch/pytorch3d/pull/24

Differential Revision: D19801629

Pulled By: nikhilaravi

fbshipit-source-id: 59459f701e0a4c02e749a1b594ca77935fd037d1
2020-02-07 17:15:08 -08:00
Nikhila Ravi
15d3a4557e Setup website with docusaurus (#11)
Summary:
Set up landing page, docs page, and html versions of the ipython notebook tutorials.
Pull Request resolved: https://github.com/fairinternal/pytorch3d/pull/11

Reviewed By: gkioxari

Differential Revision: D19730380

Pulled By: nikhilaravi

fbshipit-source-id: 5df8d3f2ac2f8dce4d51f5d14fc336508c2fd0ea
2020-02-04 17:27:16 -08:00
Nikhila Ravi
fd9df7423d update requirements.txt for readthedocs (#6)
Summary:
We need to install pytorch3d in RTD. Update requirements.txt accordingly.
Pull Request resolved: https://github.com/facebookresearch/pytorch3d/pull/6

Reviewed By: gkioxari

Differential Revision: D19549348

Pulled By: nikhilaravi

fbshipit-source-id: d8d6efe0af9c0d4c7cc6f7662d392f5b3bc16a8c
2020-01-23 17:31:05 -08:00
Nikhila Ravi
1af6af9bc1 add docs/requirements.txt for readthedocs.io
Summary: Pull Request resolved: https://github.com/facebookresearch/pytorch3d/pull/5

Reviewed By: gkioxari

Differential Revision: D19548185

Pulled By: nikhilaravi

fbshipit-source-id: edc825d483a29f1a3311d46b4f349a6bc330c085
2020-01-23 16:40:15 -08:00
Nikhila Ravi
349a499f33 update conf.py for readthedocs
Summary: Pull Request resolved: https://github.com/facebookresearch/pytorch3d/pull/4

Differential Revision: D19546949

Pulled By: nikhilaravi

fbshipit-source-id: ce30785322a60c408fd6aa2f1cd3eb5d07015c7b
2020-01-23 15:55:32 -08:00
facebook-github-bot
dbf06b504b Initial commit
fbshipit-source-id: ad58e416e3ceeca85fae0583308968d04e78fe0d
2020-01-23 11:53:46 -08:00