mirror of
https://github.com/facebookresearch/pytorch3d.git
synced 2025-08-03 04:12:48 +08:00
Change default settings of clip_barycentric_coords
Summary: When raster_settings.clip_barycentric_coords is unspecified, clip_barycentric_coords is turned on if blur_radius is greater than 0. This matches the behavior prior to D21705503 (cc70950f40
).
Reviewed By: gkioxari
Differential Revision: D23375257
fbshipit-source-id: 4b87588aabb69d4d835d4dcceb11153628121d30
This commit is contained in:
parent
c25fd83694
commit
46c0e83461
@ -37,7 +37,7 @@ class RasterizationSettings:
|
||||
bin_size: Optional[int] = None,
|
||||
max_faces_per_bin: Optional[int] = None,
|
||||
perspective_correct: bool = False,
|
||||
clip_barycentric_coords: bool = False,
|
||||
clip_barycentric_coords: Optional[bool] = None,
|
||||
cull_backfaces: bool = False,
|
||||
):
|
||||
self.image_size = image_size
|
||||
@ -125,6 +125,14 @@ class MeshRasterizer(nn.Module):
|
||||
"""
|
||||
meshes_screen = self.transform(meshes_world, **kwargs)
|
||||
raster_settings = kwargs.get("raster_settings", self.raster_settings)
|
||||
|
||||
# By default, turn on clip_barycentric_coords if blur_radius > 0.
|
||||
# When blur_radius > 0, a face can be matched to a pixel that is outside the
|
||||
# face, resulting in negative barycentric coordinates.
|
||||
clip_barycentric_coords = raster_settings.clip_barycentric_coords
|
||||
if clip_barycentric_coords is None:
|
||||
clip_barycentric_coords = raster_settings.blur_radius > 0.0
|
||||
|
||||
# TODO(jcjohns): Should we try to set perspective_correct automatically
|
||||
# based on the type of the camera?
|
||||
pix_to_face, zbuf, bary_coords, dists = rasterize_meshes(
|
||||
@ -135,7 +143,7 @@ class MeshRasterizer(nn.Module):
|
||||
bin_size=raster_settings.bin_size,
|
||||
max_faces_per_bin=raster_settings.max_faces_per_bin,
|
||||
perspective_correct=raster_settings.perspective_correct,
|
||||
clip_barycentric_coords=raster_settings.clip_barycentric_coords,
|
||||
clip_barycentric_coords=clip_barycentric_coords,
|
||||
cull_backfaces=raster_settings.cull_backfaces,
|
||||
)
|
||||
return Fragments(
|
||||
|
Loading…
x
Reference in New Issue
Block a user