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

Focus on current bounding-box when resetting camera-eye on a 3D space view (double click it) #5209

Merged
merged 2 commits into from
Feb 16, 2024

Conversation

Wumpf
Copy link
Member

@Wumpf Wumpf commented Feb 15, 2024

What

Bit back and forth on this: Originally also wanted to track the non-accumulated bounding box when data comes in, but for many scenes this gets too awkward.

Checklist

  • I have read and agree to Contributor Guide and the Code of Conduct
  • I've included a screenshot or gif (if applicable)
  • I have tested the web demo (if applicable):
  • The PR title and labels are set such as to maximize their usefulness for the next release's CHANGELOG
  • If applicable, add a new check to the release checklist!

…uses the current bounding box, not the accumulated
Copy link
Member

@teh-cmc teh-cmc left a comment

Choose a reason for hiding this comment

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

Yeah makes more sense I think

crates/re_space_view_spatial/src/ui_3d.rs Outdated Show resolved Hide resolved
@emilk emilk changed the title Resetting the camera on a 3d space view (double click it) focuses the current bounding box, not an accumulated one Focus on current bounding-box when resetting camera-eye on a 3D space view (double click it) Feb 16, 2024
Comment on lines +98 to +100
// Mark as interaction since we want to stop doing any automatic interpolations,
// even if this is caused by a full reset.
self.last_eye_interaction = Some(Instant::now());
Copy link
Member

Choose a reason for hiding this comment

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

When tracking an entity (camera), reset_camera is called each frame, I believe.

Won't resetting last_eye_interaction each frame cause the center of the orbit camera to show up each frame?

Also, what does this have to do with the PR description?

Copy link
Member Author

Choose a reason for hiding this comment

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

no, tracking works differently, there's a tracked_entity for which there's special code how to handle that, in fact reset_camera sets tracked_entity to None. The last eye interaction is set here to stop this snippet from operating https://github.com/rerun-io/rerun/blob/main/crates/re_space_view_spatial/src/ui_3d.rs#L113

Copy link
Member Author

Choose a reason for hiding this comment

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

Originally I also wanted that thing

        if self.last_eye_interaction.is_none() {
            self.interpolate_to_orbit_eye(default_eye(
                &bounding_boxes.accumulated,
                scene_view_coordinates,
            ));
        }

to use the current bounding box, but in many example scenes this looks too jerky

Copy link
Member Author

Choose a reason for hiding this comment

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

accumulated bounding box is pretty bad generally. If you spawned your objects at the origin and then transformed them where they should go, you always have the origin in your bounding box despite it being far off. There's no way for us to tell whether it's part of the scene or not

@Wumpf Wumpf merged commit 131023f into main Feb 16, 2024
39 of 41 checks passed
@Wumpf Wumpf deleted the andreas/reset-camera-to-curren-instead-of-accumulated branch February 16, 2024 12:14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Too large accumulated bounding box often leads to poor default camera view
3 participants