Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix work groups of depth compute shader #633

Merged
merged 4 commits into from
Feb 12, 2024

Conversation

fredyshox
Copy link
Contributor

@fredyshox fredyshox commented Feb 6, 2024

What changes do you make in this PR?

The number of work groups in depth_camera.py is fixed to (64, 64, 1), which limits the resolution to (1024, 1024) [=16x64]. The solution is to dynamically calculate the number of work groups based on the image resolution and shader thread group size.

Here's an example showcasing the issue:

sensors = {"depth": (DepthCamera, 1500, 1500)}
env = MetaDriveEnv({
  "image_observation": True,
  "use_render": False,
  "traffic_density": False,
  "stack_size": 1,
  "sensors": sensors,
  "vehicle_config": {
    "image_source": "depth"
  }
})
env.reset()
obs, _, _, _, _ = env.step((0, 0))

plt.imshow(obs["image"][:, :, :, -1])
plt.show()

bug

Checklist

  • I have merged the latest main branch into current branch.
  • I have run bash scripts/format.sh before merging.
  • Please use "squash and merge" mode.

@QuanyiLi QuanyiLi merged commit a369fd1 into metadriverse:main Feb 12, 2024
12 of 13 checks passed
@QuanyiLi
Copy link
Member

Great to have this parameter calculated on the fly. Thank you!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants