mirror of
https://github.com/facebookresearch/pytorch3d.git
synced 2026-03-11 14:55:59 +08:00
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
This commit is contained in:
committed by
Facebook GitHub Bot
parent
32ad869dea
commit
d01e722849
@@ -208,7 +208,7 @@ __global__ void RasterizeMeshesNaiveCudaKernel(
|
||||
const int n = i / (H * W); // batch index.
|
||||
const int pix_idx = i % (H * W);
|
||||
|
||||
// Determine ordering based on axis convention.
|
||||
// Reverse ordering of X and Y axes
|
||||
const int yi = H - 1 - pix_idx / W;
|
||||
const int xi = W - 1 - pix_idx % W;
|
||||
|
||||
@@ -353,7 +353,7 @@ __global__ void RasterizeMeshesBackwardCudaKernel(
|
||||
const int n = t_i / (H * W); // batch index.
|
||||
const int pix_idx = t_i % (H * W);
|
||||
|
||||
// Determine ordering based on axis convention.
|
||||
// Reverse ordering of X and Y axes.
|
||||
const int yi = H - 1 - pix_idx / W;
|
||||
const int xi = W - 1 - pix_idx % W;
|
||||
|
||||
@@ -557,8 +557,8 @@ __global__ void RasterizeMeshesCoarseCudaKernel(
|
||||
// need to add/subtract a half pixel to get the true extent of the bin.
|
||||
// Reverse ordering of Y axis so that +Y is upwards in the image.
|
||||
const int yidx = num_bins - by;
|
||||
float bin_y_max = PixToNdc(yidx * bin_size - 1, H) + half_pix;
|
||||
float bin_y_min = PixToNdc((yidx - 1) * bin_size, H) - half_pix;
|
||||
const float bin_y_max = PixToNdc(yidx * bin_size - 1, H) + half_pix;
|
||||
const float bin_y_min = PixToNdc((yidx - 1) * bin_size, H) - half_pix;
|
||||
|
||||
const bool y_overlap = (ymin <= bin_y_max) && (bin_y_min < ymax);
|
||||
|
||||
@@ -566,8 +566,8 @@ __global__ void RasterizeMeshesCoarseCudaKernel(
|
||||
// X coordinate of the left and right of the bin.
|
||||
// Reverse ordering of x axis so that +X is left.
|
||||
const int xidx = num_bins - bx;
|
||||
float bin_x_max = PixToNdc(xidx * bin_size - 1, W) + half_pix;
|
||||
float bin_x_min = PixToNdc((xidx - 1) * bin_size, W) - half_pix;
|
||||
const float bin_x_max = PixToNdc(xidx * bin_size - 1, W) + half_pix;
|
||||
const float bin_x_min = PixToNdc((xidx - 1) * bin_size, W) - half_pix;
|
||||
|
||||
const bool x_overlap = (xmin <= bin_x_max) && (bin_x_min < xmax);
|
||||
if (y_overlap && x_overlap) {
|
||||
|
||||
Reference in New Issue
Block a user