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

Make the near clipping plane editable in 2D views #8348

Merged
merged 15 commits into from
Dec 9, 2024

Conversation

jleibs
Copy link
Member

@jleibs jleibs commented Dec 6, 2024

What

This adjusts the value to now be in physical scene units. I.e. for most 3d scenes in meters, the clip plane will be 10cm, which is a very reasonable default.

Additionally, this gives users an escape hatch for scenes where the default clipping plane causes their data to not be visible.

Test script:

import rerun as rr
import rerun.blueprint as rrb
import numpy as np

rr.init("rerun_example_pinhole_perspective", spawn=True)

img = np.zeros((300, 300, 3), dtype=np.uint8)

cam_proj = [152.34006, 0, 175.5, 0, 152.34006, 175.5, 0, 0, 1]

rr.log(
    "world/cam",
    rr.Pinhole(
        image_from_camera=cam_proj, width=300, height=300, image_plane_distance=0.1
    ),
)

rr.log("world/cam", rr.Image(img))

rr.log(
    "world/points",
    rr.Points3D([(0.0, 0.5, 0.1), (0.1, 0.1, 0.3), (-0.1, -0.1, 0.5)], radii=0.025),
)
rr.log_file_from_path("examples/assets/example.gltf")
rr.log("examples/assets", rr.Transform3D(translation=[0, 0, 0.4], scale=0.05))

rr.send_blueprint(
    rrb.Horizontal(
        rrb.Spatial3DView(),
        rrb.Spatial2DView(
            origin="world/cam",
            contents="/**",
            visual_bounds=rrb.VisualBounds2D(
                near_clip_plane=0.01,
            ),
        ),
    )
)

New issues:

@jleibs jleibs added enhancement New feature or request 📺 re_viewer affects re_viewer itself include in changelog labels Dec 6, 2024
Copy link

github-actions bot commented Dec 6, 2024

Latest documentation preview deployed successfully.

Result Commit Link
b8a538a https://landing-oej420uc4-rerun.vercel.app/docs

Note: This comment is updated whenever you push a commit.

Copy link

github-actions bot commented Dec 6, 2024

Web viewer built successfully. If applicable, you should also test it:

  • I have tested the web viewer
Result Commit Link
b8a538a https://rerun.io/viewer/pr/8348

Note: This comment is updated whenever you push a commit.

@jleibs jleibs marked this pull request as ready for review December 6, 2024 18:41
@jleibs jleibs requested a review from Wumpf December 6, 2024 18:49
@Wumpf
Copy link
Member

Wumpf commented Dec 9, 2024

Any reason not to use a smaller default like 0.01?

We get flickering when zooming in on some scenes. Objectron showed that quite well back then.
All this comes from the fact that we render our 2d "background" at a fixed depth, meaning we have to sandwich the entire 3D scene between that depth & the fixed camera position -> we throw a lot of precision out of the window :(
This can be solved once we get rid of depth-offsetting for 2D which can be done once we've done draw order in the renderer which in turn again is part of the transparency story.

Copy link
Member

@Wumpf Wumpf left a comment

Choose a reason for hiding this comment

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

lgtm

Also unsure about the visual bounds aspect 🤔. But that's the lowest friction place right now, we can always move it around again 🤷

Comment on lines 20 to 21
/// Controls the distance to the near clipping plane
clipping_plane: rerun.blueprint.components.ClippingPlane ("attr.rerun.component_optional", order: 2000);
Copy link
Member

Choose a reason for hiding this comment

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

maybe better to call the field near_clip_plane - near for descriptiveness, clip for brevity (and the type then ClipPlane)

(?)

@jleibs jleibs merged commit 29c1f83 into main Dec 9, 2024
37 checks passed
@jleibs jleibs deleted the jleibs/configure_near_plane branch December 9, 2024 18:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request include in changelog 📺 re_viewer affects re_viewer itself
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants