Texture UV Documentation Correction (#409)

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

Reviewed By: bottler

Differential Revision: D24478451

Pulled By: nikhilaravi

fbshipit-source-id: 933d6f7a02a3118ee30ecda045fd9f62a7df1176
This commit is contained in:
Shubham Jain 2020-10-22 11:37:24 -07:00 committed by Facebook GitHub Bot
parent e7d7fad1e8
commit 4d8f132a78

View File

@ -60,7 +60,7 @@ While we tried to emulate several aspects of OpenGL, there are differences in th
For mesh texturing we offer several options (in `pytorch3d/renderer/mesh/texturing.py`):
1. **Vertex Textures**: D dimensional textures for each vertex (for example an RGB color) which can be interpolated across the face. This can be represented as an `(N, V, D)` tensor. This is a fairly simple representation though and cannot model complex textures if the mesh faces are large.
2. **UV Textures**: vertex UV coordinates and **one** texture map for the whole face. For a point on a face with given barycentric coordinates, the face color can be computed by interpolating the vertex uv coordinates and then sampling from the texture map. This representation requires two tensors (UVs: `(N, V, 2), Texture map: `(N, H, W, 3)`), and is limited to only support one texture map per mesh.
2. **UV Textures**: vertex UV coordinates and **one** texture map for the whole mesh. For a point on a face with given barycentric coordinates, the face color can be computed by interpolating the vertex uv coordinates and then sampling from the texture map. This representation requires two tensors (UVs: `(N, V, 2), Texture map: `(N, H, W, 3)`), and is limited to only support one texture map per mesh.
3. **Face Textures**: In more complex cases such as ShapeNet meshes, there are multiple texture maps per mesh and some faces have texture while other do not. For these cases, a more flexible representation is a texture atlas, where each face is represented as an `(RxR)` texture map where R is the texture resolution. For a given point on the face, the texture value can be sampled from the per face texture map using the barycentric coordinates of the point. This representation requires one tensor of shape `(N, F, R, R, 3)`. This texturing method is inspired by the SoftRasterizer implementation. For more details refer to the [`make_material_atlas`](https://github.com/facebookresearch/pytorch3d/blob/master/pytorch3d/io/mtl_io.py#L123) and [`sample_textures`](https://github.com/facebookresearch/pytorch3d/blob/master/pytorch3d/renderer/mesh/textures.py#L452) functions.
<img src="assets/texturing.jpg" width="1000">