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

Implement outlines for points 2d/3d/depth & use them for select & hover in Viewer #1568

Merged
merged 9 commits into from
Mar 13, 2023

Conversation

Wumpf
Copy link
Member

@Wumpf Wumpf commented Mar 11, 2023

Migrates the last primitives, points 2d/3d & depth cloud, over to outline based selection. Closes #889, from here on out there is still cleanup and more improvements to make, but we got where we wanted to be in rough strokes!
Some of the cleanup already happens here because of unused-warnings, but there's a bit more to do.

Clip demonstrating what it looks like as well as what it looks like for small & large points. Unsurprisingly it works out best for connected points.
https://user-images.githubusercontent.com/1220815/224499438-abf2bba4-7262-414e-88c7-65d25f0014ea.mov
(yes it also works for 2D, not dmonstrated here because as time of recording that wasn't done yet)

Approach on single points is identical to #1553

Note that depth cloud didn't have any selection highlight before (this pr naturally doesn't fix picking for it and doesn't allow selecting single points for it either)

Unsurprisingly this also speeds up point processing! Nowhere near the depth cloud feature and not nearly enough to close issue #850, but a fair bit!
For the the usual unscientific nyud demo testscenario (very long point history, loop a bunch of frames at end) I'm getting 2.5ms for free in release mode, mostly in color processing.

Before:
Screenshot 2023-03-11 at 17 54 52

After:
Screenshot 2023-03-11 at 17 52 30

Checklist

@Wumpf Wumpf added 🔺 re_renderer affects re_renderer itself 📺 re_viewer affects re_viewer itself 🚀 performance Optimization, memory use, etc labels Mar 11, 2023
Copy link
Member

@emilk emilk left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🥳

@@ -13,6 +13,8 @@ var color_texture: texture_2d<f32>;
struct BatchUniformBuffer {
world_from_obj: Mat4,
flags: u32,
_padding: UVec2, // UVec3 would take its own 4xf32 row, UVec2 is on the same as flags
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need to pad at all?

Copy link
Member Author

@Wumpf Wumpf Mar 13, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's either here or in Rust. If we put nothing here they get on the same "row" since alignment for UVec2 is 8. https://www.w3.org/TR/WGSL/#alignment-and-size

This then translates to

pub struct BatchUniformBuffer {
    pub world_from_obj: wgpu_buffer_types::Mat4,
    pub flags: u32,                   // PointCloudBatchFlags
    pub outline_mask_ids: glam::Vec2,

    pub end_padding: [wgpu_buffer_types::PaddingRow; 16 - 5],
}

But bytemuck doesn't like this because that implies 32bit padding after outline_mask_ids and it forces all padding to be explicit. So we end up with

pub struct BatchUniformBuffer {
  pub world_from_obj: wgpu_buffer_types::Mat4,
  pub flags: u32,                   // PointCloudBatchFlags
  pub outline_mask_ids: glam::Vec2,
  pub _padding: u32,

  pub end_padding: [wgpu_buffer_types::PaddingRow; 16 - 5],
}

crates/re_renderer/src/renderer/depth_cloud.rs Outdated Show resolved Hide resolved
crates/re_renderer/src/renderer/point_cloud.rs Outdated Show resolved Hide resolved
crates/re_renderer/src/renderer/point_cloud.rs Outdated Show resolved Hide resolved
crates/re_renderer/src/renderer/point_cloud.rs Outdated Show resolved Hide resolved
crates/re_renderer/src/renderer/point_cloud.rs Outdated Show resolved Hide resolved
@Wumpf Wumpf merged commit 4b4f76a into main Mar 13, 2023
@Wumpf Wumpf deleted the andreas/outline-based-selection-for-point-like branch March 13, 2023 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🚀 performance Optimization, memory use, etc 🔺 re_renderer affects re_renderer itself 📺 re_viewer affects re_viewer itself
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Use (thick) postprocessing driven outlines for highlight selections
2 participants