Skip to content

Commit

Permalink
rasterization header comment fixes
Browse files Browse the repository at this point in the history
Summary: Fix some missing or misplaced argument descriptions.

Reviewed By: nikhilaravi

Differential Revision: D31305132

fbshipit-source-id: af4fcee9766682b2b7f7f16327e839090e377be2
  • Loading branch information
bottler authored and facebook-github-bot committed Sep 30, 2021
1 parent a5cbb62 commit 4ad8576
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 8 deletions.
21 changes: 21 additions & 0 deletions pytorch3d/csrc/rasterize_meshes/rasterize_meshes.h
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@ RasterizeMeshesNaiveCuda(
// coordinates for each pixel; if this is False then
// this function instead returns screen-space
// barycentric coordinates for each pixel.
// clip_barycentric_coords: Whether, after any perspective correction
// is applied but before the depth is calculated (e.g. for
// z clipping), to "correct" a location outside the face (i.e. with
// a negative barycentric coordinate) to a position on the edge of the
// face.
// cull_backfaces: Bool, Whether to only rasterize mesh faces which are
// visible to the camera. This assumes that vertices of
// front-facing triangles are ordered in an anti-clockwise
Expand Down Expand Up @@ -191,6 +196,11 @@ torch::Tensor RasterizeMeshesBackwardCuda(
// coordinates for each pixel; if this is False then
// this function instead returns screen-space
// barycentric coordinates for each pixel.
// clip_barycentric_coords: Whether, after any perspective correction
// is applied but before the depth is calculated (e.g. for
// z clipping), to "correct" a location outside the face (i.e. with
// a negative barycentric coordinate) to a position on the edge of the
// face.
//
// Returns:
// grad_face_verts: float32 Tensor of shape (F, 3, 3) giving downstream
Expand Down Expand Up @@ -352,6 +362,11 @@ RasterizeMeshesFineCuda(
// coordinates for each pixel; if this is False then
// this function instead returns screen-space
// barycentric coordinates for each pixel.
// clip_barycentric_coords: Whether, after any perspective correction
// is applied but before the depth is calculated (e.g. for
// z clipping), to "correct" a location outside the face (i.e. with
// a negative barycentric coordinate) to a position on the edge of the
// face.
// cull_backfaces: Bool, Whether to only rasterize mesh faces which are
// visible to the camera. This assumes that vertices of
// front-facing triangles are ordered in an anti-clockwise
Expand Down Expand Up @@ -441,6 +456,7 @@ RasterizeMeshesFine(
// blur_radius: float distance in NDC coordinates uses to expand the face
// bounding boxes for the rasterization. Set to 0.0 if no blur
// is required.
// faces_per_pixel: the number of closeset faces to rasterize per pixel.
// bin_size: Bin size (in pixels) for coarse-to-fine rasterization. Setting
// bin_size=0 uses naive rasterization instead.
// max_faces_per_bin: The maximum number of faces allowed to fall into each
Expand All @@ -451,6 +467,11 @@ RasterizeMeshesFine(
// coordinates for each pixel; if this is False then
// this function instead returns screen-space
// barycentric coordinates for each pixel.
// clip_barycentric_coords: Whether, after any perspective correction
// is applied but before the depth is calculated (e.g. for
// z clipping), to "correct" a location outside the face (i.e. with
// a negative barycentric coordinate) to a position on the edge of the
// face.
// cull_backfaces: Bool, Whether to only rasterize mesh faces which are
// visible to the camera. This assumes that vertices of
// front-facing triangles are ordered in an anti-clockwise
Expand Down
14 changes: 8 additions & 6 deletions pytorch3d/csrc/rasterize_points/rasterize_points.h
Original file line number Diff line number Diff line change
Expand Up @@ -48,10 +48,10 @@ RasterizePointsNaiveCuda(
// in the batch where N is the batch size.
// num_points_per_cloud: LongTensor of shape (N) giving the number of points
// for each pointcloud in the batch.
// radius: FloatTensor of shape (P) giving the radius (in NDC units) of
// each point in points.
// image_size: Tuple (H, W) giving the size in pixels of the output
// image to be rasterized.
// radius: FloatTensor of shape (P) giving the radius (in NDC units) of
// each point in points.
// points_per_pixel: (K) The number closest of points to return for each pixel
//
// Returns:
Expand Down Expand Up @@ -126,11 +126,13 @@ torch::Tensor RasterizePointsCoarseCpu(
// in the batch where N is the batch size.
// num_points_per_cloud: LongTensor of shape (N) giving the number of points
// for each pointcloud in the batch.
// radius: FloatTensor of shape (P) giving the radius (in NDC units) of
// each point in points.
// image_size: Tuple (H, W) giving the size in pixels of the output
// image to be rasterized.
// radius: FloatTensor of shape (P) giving the radius (in NDC units) of
// each point in points.
// bin_size: Size of each bin within the image (in pixels)
// max_points_per_bin: The maximum number of points allowed to fall into each
// bin when using coarse-to-fine rasterization.
//
// Returns:
// points_per_bin: Tensor of shape (N, num_bins, num_bins) giving the number
Expand Down Expand Up @@ -303,10 +305,10 @@ torch::Tensor RasterizePointsBackward(
// in the batch where N is the batch size.
// num_points_per_cloud: LongTensor of shape (N) giving the number of points
// for each pointcloud in the batch.
// radius: FloatTensor of shape (P) giving the radius (in NDC units) of
// each point in points.
// image_size: Tuple (H, W) giving the size in pixels of the output
// image to be rasterized.
// radius: FloatTensor of shape (P) giving the radius (in NDC units) of
// each point in points.
// points_per_pixel: (K) The number of points to return for each pixel
// bin_size: Bin size (in pixels) for coarse-to-fine rasterization. Setting
// bin_size=0 uses naive rasterization instead.
Expand Down
2 changes: 1 addition & 1 deletion pytorch3d/renderer/mesh/rasterize_meshes.py
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ def rasterize_meshes(
bin_size=0 uses naive rasterization; setting bin_size=None attempts to
set it heuristically based on the shape of the input. This should not
affect the output, but can affect the speed of the forward pass.
faces_per_bin: Only applicable when using coarse-to-fine rasterization
max_faces_per_bin: Only applicable when using coarse-to-fine rasterization
(bin_size > 0); this is the maximum number of faces allowed within each
bin. This should not affect the output values, but can affect
the memory usage in the forward pass.
Expand Down
2 changes: 1 addition & 1 deletion pytorch3d/renderer/points/rasterize_points.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ def rasterize_points(
bin_size=0 uses naive rasterization; setting bin_size=None attempts to
set it heuristically based on the shape of the input. This should not
affect the output, but can affect the speed of the forward pass.
points_per_bin: Only applicable when using coarse-to-fine rasterization
max_points_per_bin: Only applicable when using coarse-to-fine rasterization
(bin_size > 0); this is the maximum number of points allowed within each
bin. This should not affect the output values, but can affect
the memory usage in the forward pass.
Expand Down

0 comments on commit 4ad8576

Please sign in to comment.