mirror of
https://github.com/facebookresearch/pytorch3d.git
synced 2025-12-20 22:30:35 +08:00
Alpha channel to return the mask
Summary: Updated the alpha channel in the `hard_rgb_blend` function to return the mask of the pixels which have overlapping mesh faces. Reviewed By: bottler Differential Revision: D29001604 fbshipit-source-id: 22a2173d769f2d3ad34892d68ceb628f073bca22
This commit is contained in:
committed by
Facebook GitHub Bot
parent
ac6c07fa43
commit
a15c33a3cc
@@ -125,6 +125,10 @@ class TestRenderMeshes(TestCaseMixin, unittest.TestCase):
|
||||
)
|
||||
images, fragments = renderer(sphere_mesh)
|
||||
self.assertClose(fragments.zbuf, rasterizer(sphere_mesh).zbuf)
|
||||
# Check the alpha channel is the mask
|
||||
self.assertClose(
|
||||
images[..., -1], (fragments.pix_to_face[..., 0] >= 0).float()
|
||||
)
|
||||
else:
|
||||
renderer = MeshRenderer(rasterizer=rasterizer, shader=shader)
|
||||
images = renderer(sphere_mesh)
|
||||
@@ -165,6 +169,10 @@ class TestRenderMeshes(TestCaseMixin, unittest.TestCase):
|
||||
self.assertClose(
|
||||
fragments.zbuf, rasterizer(sphere_mesh, lights=lights).zbuf
|
||||
)
|
||||
# Check the alpha channel is the mask
|
||||
self.assertClose(
|
||||
images[..., -1], (fragments.pix_to_face[..., 0] >= 0).float()
|
||||
)
|
||||
else:
|
||||
phong_renderer = MeshRenderer(
|
||||
rasterizer=rasterizer, shader=phong_shader
|
||||
|
||||
Reference in New Issue
Block a user