mirror of
https://github.com/facebookresearch/pytorch3d.git
synced 2025-12-20 06:10:34 +08:00
shader: fix HardDepthShader sizes + tests (#1252)
Summary: This fixes a indexing bug in HardDepthShader and adds proper unit tests for both of the DepthShaders. This bug was introduced when updating the shader sizes and discovered when I switched my local model onto pytorch3d trunk instead of the patched copy. Pull Request resolved: https://github.com/facebookresearch/pytorch3d/pull/1252 Test Plan: Unit test + custom model code ``` pytest tests/test_shader.py ```  Reviewed By: bottler Differential Revision: D37775767 Pulled By: d4l3k fbshipit-source-id: 5f001903985976d7067d1fa0a3102d602790e3e8
This commit is contained in:
committed by
Facebook GitHub Bot
parent
8d10ba52b2
commit
4ecc9ea89d
@@ -374,11 +374,11 @@ class HardDepthShader(ShaderBase):
|
||||
cameras = super()._get_cameras(**kwargs)
|
||||
|
||||
zfar = kwargs.get("zfar", getattr(cameras, "zfar", 100.0))
|
||||
mask = fragments.pix_to_face < 0
|
||||
mask = fragments.pix_to_face[..., 0:1] < 0
|
||||
|
||||
zbuf = fragments.zbuf[..., 0].clone()
|
||||
zbuf = fragments.zbuf[..., 0:1].clone()
|
||||
zbuf[mask] = zfar
|
||||
return zbuf.unsqueeze(3)
|
||||
return zbuf
|
||||
|
||||
|
||||
class SoftDepthShader(ShaderBase):
|
||||
|
||||
Reference in New Issue
Block a user