mirror of
https://github.com/facebookresearch/pytorch3d.git
synced 2025-12-20 22:30:35 +08:00
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
This commit is contained in:
committed by
Facebook Github Bot
parent
767d68a3af
commit
15c72be444
@@ -41,7 +41,7 @@ def sigmoid_blend_naive_loop(colors, fragments, blend_params):
|
||||
pixel_colors[n, h, w, :3] = colors[n, h, w, 0, :]
|
||||
pixel_colors[n, h, w, 3] = 1.0 - alpha
|
||||
|
||||
return torch.flip(pixel_colors, [1])
|
||||
return pixel_colors
|
||||
|
||||
|
||||
def sigmoid_blend_naive_loop_backward(
|
||||
@@ -54,8 +54,6 @@ def sigmoid_blend_naive_loop_backward(
|
||||
N, H, W, K = pix_to_face.shape
|
||||
device = pix_to_face.device
|
||||
grad_distances = torch.zeros((N, H, W, K), dtype=dists.dtype, device=device)
|
||||
images = torch.flip(images, [1])
|
||||
grad_images = torch.flip(grad_images, [1])
|
||||
|
||||
for n in range(N):
|
||||
for h in range(H):
|
||||
@@ -130,7 +128,7 @@ def softmax_blend_naive(colors, fragments, blend_params):
|
||||
pixel_colors[n, h, w, :3] += (delta / denom) * bk_color
|
||||
pixel_colors[n, h, w, 3] = 1.0 - alpha
|
||||
|
||||
return torch.flip(pixel_colors, [1])
|
||||
return pixel_colors
|
||||
|
||||
|
||||
class TestBlending(unittest.TestCase):
|
||||
|
||||
Reference in New Issue
Block a user