isl-org / isl-org/Open3D

Blocky / incomplete raycast output

Open
#5,344 9 comments 3 reactions 1 assignee Claimed by @reyanshsolis View on GitHub
bug
Dominant language
C++
Stars
14k
Forks
2.6k
Avg merge
5d 18h
Merged PRs (30d)
6

Description

### Checklist

- [X] I have searched for [similar issues](https://github.com/isl-org/Open3D/issues).
- [X] For Python issues, I have tested with the [latest development wheel](http://www.open3d.org/docs/latest/getting_started.html#development-version-pip).
- [X] I have checked the [release documentation](http://www.open3d.org/docs/release/) and the [latest documentation](http://www.open3d.org/docs/latest/) (for `master` branch).

### Describe the issue

I'm working on code derived from the new SLAM reconstruction model and so far it works very well and is very fast, with the exception of situations in which the raycasting to generate synthetic frames produces bad output. This always seems to be the case for larger voxel grid sizes -- say, .010 but I have seen it even on .002 voxel grid sizes.

### .01 output

The artifacting is worse the larger the voxel grid is.

Raycast:
![raycast_vs01](https://user-images.githubusercontent.com/8194827/180270025-5dccad23-a8fd-49c3-88de-5641ddd09975.png)

Pointcloud:
![pointcloud_vs01](https://user-images.githubusercontent.com/8194827/180270176-2bd64a05-b7b3-4761-827d-8fef6f1bcd02.png)

Frustrum (plotted voxels from -.5 to .5 tsdf, same frustrum given to raycast)
![frustrum_v01](https://user-images.githubusercontent.com/8194827/180270396-44a7b06b-9424-4075-b2c2-fe7420422f27.png)

Raycast superimposed on PC:
![raycast_over_pc_vs01](https://user-images.githubusercontent.com/8194827/180270569-148a6047-dbca-4290-aa24-4dea0b7fe110.png)

Raycast superimposed over frustrum
![raycast_over_frustrum_vs01](https://user-images.githubusercontent.com/8194827/180270809-94868351-42f7-4784-9821-acea074e3095.png)

Note that my tooling regenerates everything to turn on frustrum visibility; each call to raycast generates different splotchy output seemingly at random

### .003 output

Same artifacts at .003 on same dataset

![raycast_vs003](https://user-images.githubusercontent.com/8194827/180271206-08d38c7d-bb60-4b88-8868-29cb9c2c124f.png)
![pointcloud_vs003](https://user-images.githubusercontent.com/8194827/180271203-b8188f9d-21e6-4154-99fe-3a759e334dae.png)

![raycast_over_pc_vs003](https://user-images.githubusercontent.com/8194827/180271194-73da3385-809c-4bf1-9afb-61bb739638ac.png)

![frustrum_vs003](https://user-images.githubusercontent.com/8194827/180271200-22eec54a-14ce-470a-9f25-ff65e371a46e.png)

![frustrum_back_vs003](https://user-images.githubusercontent.com/8194827/180271197-84aaaaec-42a4-44e2-ad52-2c6ba18b2bd4.png)

### Things I've tried:

- Changing weight threshold, trunc_voxel_multiplier, range_map_down_factor on raycast call. No setting there changes this behavior.
- Controlling trunc_voxel_multiplier for frustrum generation independently. This really didn't do anything either
- Running raycast on CPU like so:
```
hashap : o3d.core.HashMap = voxel_grid.hashmap()
hashap.cpu()
raycast_frame = voxel_grid.ray_cast(block_coords=frustum_block_coords_t,
intrinsic = self.intrinsics,
extrinsic = extrinsics,
width = self.input_frame.width(),
height= self.input_frame.height(),
render_attributes=attrs,
depth_scale = 1000.0,
depth_min = config.depth_min,
depth_max = config.depth_max,
weight_threshold=weight_thresh,
trunc_voxel_multiplier=config.trunc_voxel_render, range_map_down_factor=8)
hashap.cuda()
```
This didnt change the behavior; which implies it's not a GPU issue although it is sorta hard to verify externally whether that is truly running on CPU or not.

### Steps to reproduce the bug

```python
I've seen this issue with a custom dataset using the instructions here: http://www.open3d.org/html/tutorial/t_reconstruction_system/index.html. Currently I'm running more tailored python code than that. Here is the npz of the voxel grid from the screenshots -- https://drive.google.com/file/d/1HGRqOTGA2bYpCVzTQFKZKI9hjTOhTG6X/view?usp=sharing -- and I'd expect raytracing to have the same artifacts on that.
```

### Error message

_No response_

### Expected behavior

I'd expect the raytracing to mostly look like the generated pointcloud from the given perspective assuming generation inputs -- weight threshold, voxelgrid, etc -- being the same.

### Open3D, Python and System information

```markdown
- Operating system: Ubuntu 20.04
- Python version: 3.8.10 (default, Mar 15 2022, 12:22:08) [GCC 9.4.0]
- Open3D version: 0.15.2 and 0.15.2+99c361c
- System architecture: x86
- Is this a remote workstation?: no, but it is running in a docker
- How did you install Open3D?: pip
```

### Additional information

_No response_

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.