-
Notifications
You must be signed in to change notification settings - Fork 373
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Improve the depth backprojection feature (#1690)
* Replace the backproject scale with the familiar "meter" * Assume depth images usually start at zero * Make the depth point radius scale more sane * Fix an off-by-half error, giving all points an extra 0.5 pixels in radius * Add a fudge-factor * Improve tooltip * Fix typos * Fix doclink * Fix the math * fix typo Co-authored-by: Andreas Reich <[email protected]> * #[inline] * Another typo * typo Co-authored-by: Andreas Reich <[email protected]> * Adjust the feathering margins * Clean up the depth texture uploading * Better docs * fix typos * Use world depth values in the shader and simplify user code * Better naming * Fix bug in the image-hover code * Use same depth range for the color map in the depth projection shader * Fix the gamma of the wgsl color map * Tweak default point radius to avoid Moiré patterns * Final touches * spell fix * more typos Co-authored-by: Andreas Reich <[email protected]> * Fix comment about why we use Depth16Unorm * Add lines to changelog * max_depth -> max_depth_in_world --------- Co-authored-by: Andreas Reich <[email protected]>
- Loading branch information
Showing
13 changed files
with
284 additions
and
171 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
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
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
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
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 |
---|---|---|
|
@@ -9,6 +9,9 @@ const COLORMAP_PLASMA: u32 = 3u; | |
const COLORMAP_MAGMA: u32 = 4u; | ||
const COLORMAP_INFERNO: u32 = 5u; | ||
|
||
/// Returns a gamma-space sRGB in 0-1 range. | ||
/// | ||
/// The input will be saturated to [0, 1] range. | ||
fn colormap_srgb(which: u32, t: f32) -> Vec3 { | ||
if which == COLORMAP_TURBO { | ||
return colormap_turbo_srgb(t); | ||
|
@@ -25,6 +28,13 @@ fn colormap_srgb(which: u32, t: f32) -> Vec3 { | |
} | ||
} | ||
|
||
/// Returns a linear-space sRGB in 0-1 range. | ||
/// | ||
/// The input will be saturated to [0, 1] range. | ||
fn colormap_linear(which: u32, t: f32) -> Vec3 { | ||
return linear_from_srgb(colormap_srgb(which, t)); | ||
} | ||
|
||
// --- Turbo color map --- | ||
|
||
// Polynomial approximation in GLSL for the Turbo colormap. | ||
|
@@ -38,7 +48,8 @@ fn colormap_srgb(which: u32, t: f32) -> Vec3 { | |
// Colormap Design: Anton Mikhailov ([email protected]) | ||
// GLSL Approximation: Ruofei Du ([email protected]) | ||
|
||
/// Returns a normalized sRGB polynomial approximation from Turbo color map, assuming `t` is | ||
/// Returns a gamma-space sRGB in 0-1 range. | ||
/// This is a polynomial approximation from Turbo color map, assuming `t` is | ||
/// normalized (it will be saturated no matter what). | ||
fn colormap_turbo_srgb(t: f32) -> Vec3 { | ||
let r4 = Vec4(0.13572138, 4.61539260, -42.66032258, 132.13108234); | ||
|
@@ -73,7 +84,8 @@ fn colormap_turbo_srgb(t: f32) -> Vec3 { | |
// | ||
// Data fitted from https://github.com/BIDS/colormap/blob/master/colormaps.py (CC0). | ||
|
||
/// Returns a normalized sRGB polynomial approximation from Viridis color map, assuming `t` is | ||
/// Returns a gamma-space sRGB in 0-1 range. | ||
/// This is a polynomial approximation from Viridis color map, assuming `t` is | ||
/// normalized (it will be saturated no matter what). | ||
fn colormap_viridis_srgb(t: f32) -> Vec3 { | ||
let c0 = Vec3(0.2777273272234177, 0.005407344544966578, 0.3340998053353061); | ||
|
@@ -87,7 +99,8 @@ fn colormap_viridis_srgb(t: f32) -> Vec3 { | |
return c0 + t * (c1 + t * (c2 + t * (c3 + t * (c4 + t * (c5 + t * c6))))); | ||
} | ||
|
||
/// Returns a normalized sRGB polynomial approximation from Plasma color map, assuming `t` is | ||
/// Returns a gamma-space sRGB in 0-1 range. | ||
/// This is a polynomial approximation from Plasma color map, assuming `t` is | ||
/// normalized (it will be saturated no matter what). | ||
fn colormap_plasma_srgb(t: f32) -> Vec3 { | ||
let c0 = Vec3(0.05873234392399702, 0.02333670892565664, 0.5433401826748754); | ||
|
@@ -101,7 +114,8 @@ fn colormap_plasma_srgb(t: f32) -> Vec3 { | |
return c0 + t * (c1 + t * (c2 + t * (c3 + t * (c4 + t * (c5 + t * c6))))); | ||
} | ||
|
||
/// Returns a normalized sRGB polynomial approximation from Magma color map, assuming `t` is | ||
/// Returns a gamma-space sRGB in 0-1 range. | ||
/// This is a polynomial approximation from Magma color map, assuming `t` is | ||
/// normalized (it will be saturated no matter what). | ||
fn colormap_magma_srgb(t: f32) -> Vec3 { | ||
let c0 = Vec3(-0.002136485053939582, -0.000749655052795221, -0.005386127855323933); | ||
|
@@ -115,7 +129,8 @@ fn colormap_magma_srgb(t: f32) -> Vec3 { | |
return c0 + t * (c1 + t * (c2 + t * (c3 + t * (c4 + t * (c5 + t * c6))))); | ||
} | ||
|
||
/// Returns a normalized sRGB polynomial approximation from Inferno color map, assuming `t` is | ||
/// Returns a gamma-space sRGB in 0-1 range. | ||
/// This is a polynomial approximation from Inferno color map, assuming `t` is | ||
/// normalized (it will be saturated no matter what). | ||
fn colormap_inferno_srgb(t: f32) -> Vec3 { | ||
let c0 = Vec3(0.0002189403691192265, 0.001651004631001012, -0.01948089843709184); | ||
|
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
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.
44b748e
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rust Benchmark
datastore/insert/batch/rects/insert
554232
ns/iter (± 3138
)571338
ns/iter (± 2693
)0.97
datastore/latest_at/batch/rects/query
1897
ns/iter (± 11
)1906
ns/iter (± 7
)1.00
datastore/latest_at/missing_components/primary
287
ns/iter (± 1
)288
ns/iter (± 10
)1.00
datastore/latest_at/missing_components/secondaries
447
ns/iter (± 0
)441
ns/iter (± 0
)1.01
datastore/range/batch/rects/query
150545
ns/iter (± 2812
)151242
ns/iter (± 439
)1.00
mono_points_arrow/generate_message_bundles
48679848
ns/iter (± 458631
)52115175
ns/iter (± 1593272
)0.93
mono_points_arrow/generate_messages
126436895
ns/iter (± 1386132
)137318708
ns/iter (± 1369729
)0.92
mono_points_arrow/encode_log_msg
160382909
ns/iter (± 1529192
)170578537
ns/iter (± 1505256
)0.94
mono_points_arrow/encode_total
335957717
ns/iter (± 2040824
)359989554
ns/iter (± 2399368
)0.93
mono_points_arrow/decode_log_msg
179633170
ns/iter (± 899344
)187711171
ns/iter (± 1111261
)0.96
mono_points_arrow/decode_message_bundles
65206735
ns/iter (± 1193866
)76577898
ns/iter (± 927598
)0.85
mono_points_arrow/decode_total
236988931
ns/iter (± 2131603
)259892094
ns/iter (± 1734498
)0.91
batch_points_arrow/generate_message_bundles
337184
ns/iter (± 5751
)342372
ns/iter (± 745
)0.98
batch_points_arrow/generate_messages
6223
ns/iter (± 37
)6277
ns/iter (± 18
)0.99
batch_points_arrow/encode_log_msg
369225
ns/iter (± 1673
)370819
ns/iter (± 1737
)1.00
batch_points_arrow/encode_total
733061
ns/iter (± 4776
)733490
ns/iter (± 3067
)1.00
batch_points_arrow/decode_log_msg
350705
ns/iter (± 1406
)351943
ns/iter (± 1972
)1.00
batch_points_arrow/decode_message_bundles
2024
ns/iter (± 33
)2009
ns/iter (± 7
)1.01
batch_points_arrow/decode_total
347594
ns/iter (± 2842
)358459
ns/iter (± 1259
)0.97
arrow_mono_points/insert
6121944794
ns/iter (± 82463373
)7093925796
ns/iter (± 27956825
)0.86
arrow_mono_points/query
1810168
ns/iter (± 14005
)1807768
ns/iter (± 14211
)1.00
arrow_batch_points/insert
2661498
ns/iter (± 63894
)2632710
ns/iter (± 27478
)1.01
arrow_batch_points/query
16119
ns/iter (± 89
)16225
ns/iter (± 83
)0.99
arrow_batch_vecs/insert
42919
ns/iter (± 139
)41987
ns/iter (± 4368
)1.02
arrow_batch_vecs/query
387304
ns/iter (± 5819
)389523
ns/iter (± 478
)0.99
tuid/Tuid::random
36
ns/iter (± 0
)34
ns/iter (± 0
)1.06
This comment was automatically generated by workflow using github-action-benchmark.