-
Notifications
You must be signed in to change notification settings - Fork 365
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make the near clipping plane editable in 2D views (#8348)
### 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: ```python 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: - #8373
- Loading branch information
Showing
25 changed files
with
449 additions
and
29 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
1 change: 1 addition & 0 deletions
1
crates/store/re_types/definitions/rerun/blueprint/components.fbs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
14 changes: 14 additions & 0 deletions
14
crates/store/re_types/definitions/rerun/blueprint/components/near_clip_plane.fbs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
namespace rerun.blueprint.components; | ||
|
||
// --- | ||
|
||
/// Distance to the near clip plane used for `Spatial2DView`. | ||
struct NearClipPlane ( | ||
"attr.rerun.scope": "blueprint", | ||
"attr.rust.derive": "Copy, PartialEq, bytemuck::Pod, bytemuck::Zeroable", | ||
"attr.rust.repr": "transparent", | ||
"attr.docs.unreleased" | ||
) { | ||
/// Distance to the near clip plane in 3D scene units. | ||
near_clip_plane: rerun.datatypes.Float32 (order: 100); | ||
} |
63 changes: 55 additions & 8 deletions
63
crates/store/re_types/src/blueprint/archetypes/visual_bounds2d.rs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
116 changes: 116 additions & 0 deletions
116
crates/store/re_types/src/blueprint/components/near_clip_plane.rs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
11 changes: 11 additions & 0 deletions
11
crates/store/re_types/src/blueprint/components/near_clip_plane_ext.rs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
use re_types_core::datatypes::Float32; | ||
|
||
use super::NearClipPlane; | ||
|
||
impl Default for NearClipPlane { | ||
#[inline] | ||
fn default() -> Self { | ||
// Default near clip plane to reasonable distance for common cameras | ||
Self(Float32(0.1)) | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.