diff --git a/CONTRIBUTORS.md b/CONTRIBUTORS.md index e7d7774712d..29324fa3666 100644 --- a/CONTRIBUTORS.md +++ b/CONTRIBUTORS.md @@ -150,6 +150,7 @@ Guidelines for modifications: * Vladimir Fokow * Wei Yang * Xavier Nal +* Xiaodi Yuan * Xinjie Yao * Xinpeng Liu * Yang Jin diff --git a/source/isaaclab/isaaclab/sensors/camera/tiled_camera.py b/source/isaaclab/isaaclab/sensors/camera/tiled_camera.py index 3e9982135c5..0ed5d52673c 100644 --- a/source/isaaclab/isaaclab/sensors/camera/tiled_camera.py +++ b/source/isaaclab/isaaclab/sensors/camera/tiled_camera.py @@ -271,6 +271,11 @@ def _update_buffers_impl(self, env_ids: Sequence[int]): if data_type == "motion_vectors": tiled_data_buffer = tiled_data_buffer[:, :, :2].contiguous() + # For normals, we only require the first three channels of the tiled buffer + # Note: Not doing this breaks the alignment of the data (check: https://github.com/isaac-sim/IsaacLab/issues/4239) + if data_type == "normals": + tiled_data_buffer = tiled_data_buffer[:, :, :3].contiguous() + wp.launch( kernel=reshape_tiled_image, dim=(self._view.count, self.cfg.height, self.cfg.width), diff --git a/source/isaaclab/test/sensors/test_tiled_camera.py b/source/isaaclab/test/sensors/test_tiled_camera.py index d39c33ead24..74face26de7 100644 --- a/source/isaaclab/test/sensors/test_tiled_camera.py +++ b/source/isaaclab/test/sensors/test_tiled_camera.py @@ -670,6 +670,9 @@ def test_normals_only_camera(setup_camera, device): assert im_data.shape == (num_cameras, camera_cfg.height, camera_cfg.width, 3) for i in range(4): assert im_data[i].mean() > 0.0 + # check normal norm is approximately 1 + norms = torch.norm(im_data, dim=-1) + assert torch.allclose(norms, torch.ones_like(norms), atol=1e-9) assert camera.data.output["normals"].dtype == torch.float del camera