Use libblur for faster post processing
This commit is contained in:
44
Cargo.lock
generated
44
Cargo.lock
generated
@@ -1,6 +1,6 @@
|
|||||||
# This file is automatically @generated by Cargo.
|
# This file is automatically @generated by Cargo.
|
||||||
# It is not intended for manual editing.
|
# It is not intended for manual editing.
|
||||||
version = 3
|
version = 4
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "ab_glyph"
|
name = "ab_glyph"
|
||||||
@@ -1119,6 +1119,18 @@ version = "1.0.1"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "0b6a852b24ab71dffc585bcb46eaf7959d175cb865a7152e35b348d1b2960422"
|
checksum = "0b6a852b24ab71dffc585bcb46eaf7959d175cb865a7152e35b348d1b2960422"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "colorutils-rs"
|
||||||
|
version = "0.7.4"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "c06bb7c7479a238be740a3312b5693d76e234eb49b73b3e61ae768132c79d06a"
|
||||||
|
dependencies = [
|
||||||
|
"erydanos",
|
||||||
|
"half",
|
||||||
|
"num-traits",
|
||||||
|
"rayon",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "com"
|
name = "com"
|
||||||
version = "0.6.0"
|
version = "0.6.0"
|
||||||
@@ -1747,6 +1759,15 @@ version = "3.2.0"
|
|||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "a0474425d51df81997e2f90a21591180b38eccf27292d755f3e30750225c175b"
|
checksum = "a0474425d51df81997e2f90a21591180b38eccf27292d755f3e30750225c175b"
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "erydanos"
|
||||||
|
version = "0.2.16"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "a47baa8d6403c503aada20928019931ed367ed226ec0916f27c6a0d3af86c559"
|
||||||
|
dependencies = [
|
||||||
|
"num-traits",
|
||||||
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "event-listener"
|
name = "event-listener"
|
||||||
version = "2.5.3"
|
version = "2.5.3"
|
||||||
@@ -2249,6 +2270,7 @@ checksum = "6dd08c532ae367adf81c312a4580bc67f1d0fe8bc9c460520283f4c0ff277888"
|
|||||||
dependencies = [
|
dependencies = [
|
||||||
"cfg-if",
|
"cfg-if",
|
||||||
"crunchy",
|
"crunchy",
|
||||||
|
"num-traits",
|
||||||
]
|
]
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
@@ -2630,10 +2652,23 @@ source = "registry+https://github.com/rust-lang/crates.io-index"
|
|||||||
checksum = "03087c2bad5e1034e8cace5926dec053fb3790248370865f5117a7d0213354c8"
|
checksum = "03087c2bad5e1034e8cace5926dec053fb3790248370865f5117a7d0213354c8"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libc"
|
name = "libblur"
|
||||||
version = "0.2.155"
|
version = "0.15.1"
|
||||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c"
|
checksum = "ad0f76a47545e28b618fb7acff7d0c5b0850fe6374e2de43cfa65ac32948c0ed"
|
||||||
|
dependencies = [
|
||||||
|
"colorutils-rs",
|
||||||
|
"half",
|
||||||
|
"libc",
|
||||||
|
"num-traits",
|
||||||
|
"rayon",
|
||||||
|
]
|
||||||
|
|
||||||
|
[[package]]
|
||||||
|
name = "libc"
|
||||||
|
version = "0.2.169"
|
||||||
|
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||||
|
checksum = "b5aba8db14291edd000dfcc4d620c7ebfb122c613afb886ca8803fa4e128a20a"
|
||||||
|
|
||||||
[[package]]
|
[[package]]
|
||||||
name = "libfuzzer-sys"
|
name = "libfuzzer-sys"
|
||||||
@@ -2892,6 +2927,7 @@ dependencies = [
|
|||||||
"image 0.25.1",
|
"image 0.25.1",
|
||||||
"imageproc",
|
"imageproc",
|
||||||
"itertools 0.13.0",
|
"itertools 0.13.0",
|
||||||
|
"libblur",
|
||||||
"nalgebra 0.32.6",
|
"nalgebra 0.32.6",
|
||||||
"notify-rust",
|
"notify-rust",
|
||||||
"open",
|
"open",
|
||||||
|
@@ -16,14 +16,15 @@ criterion = "0.5.1"
|
|||||||
dirs = "5.0.1"
|
dirs = "5.0.1"
|
||||||
eframe = { version = "0.27.2", features = ["wgpu", "serde"] }
|
eframe = { version = "0.27.2", features = ["wgpu", "serde"] }
|
||||||
egui = "0.27.2"
|
egui = "0.27.2"
|
||||||
egui_dock = "0.12.0"
|
|
||||||
egui_tracing = "0.2.2"
|
|
||||||
egui-phosphor = { git = "https://github.com/connorslade/egui-phosphor" }
|
egui-phosphor = { git = "https://github.com/connorslade/egui-phosphor" }
|
||||||
egui-wgpu = "0.27.2"
|
egui-wgpu = "0.27.2"
|
||||||
|
egui_dock = "0.12.0"
|
||||||
|
egui_tracing = "0.2.2"
|
||||||
encase = { version = "0.8.0", features = ["nalgebra"] }
|
encase = { version = "0.8.0", features = ["nalgebra"] }
|
||||||
image = "0.25.1"
|
image = "0.25.1"
|
||||||
imageproc = "0.25.0"
|
imageproc = "0.25.0"
|
||||||
itertools = "0.13.0"
|
itertools = "0.13.0"
|
||||||
|
libblur = "0.15.1"
|
||||||
md5 = "0.7.0"
|
md5 = "0.7.0"
|
||||||
nalgebra = { version = "0.32.6", features = ["serde-serialize"] }
|
nalgebra = { version = "0.32.6", features = ["serde-serialize"] }
|
||||||
notify-rust = "4.11.0"
|
notify-rust = "4.11.0"
|
||||||
|
4
TODO.md
4
TODO.md
@@ -89,6 +89,6 @@
|
|||||||
- [ ] Make post processing async
|
- [ ] Make post processing async
|
||||||
- [ ] Instance meshes in save files / rendering
|
- [ ] Instance meshes in save files / rendering
|
||||||
- [x] Allow recalculating normals
|
- [x] Allow recalculating normals
|
||||||
- [ ] Cleanup self intersection resolution
|
- [x] Cleanup self intersection resolution
|
||||||
- [ ] Dont fail to load an stl without normals
|
- [ ] Dont fail to load an stl without normals
|
||||||
- [ ] Dont clone all verts and faces to recompute normals. Just add another Arc?
|
- [ ] GPU accalration for post processing effect?
|
||||||
|
@@ -12,15 +12,16 @@ clone-macro.workspace = true
|
|||||||
const_format.workspace = true
|
const_format.workspace = true
|
||||||
dirs.workspace = true
|
dirs.workspace = true
|
||||||
eframe.workspace = true
|
eframe.workspace = true
|
||||||
egui_dock.workspace = true
|
|
||||||
egui_tracing.workspace = true
|
|
||||||
egui-phosphor.workspace = true
|
egui-phosphor.workspace = true
|
||||||
egui-wgpu.workspace = true
|
egui-wgpu.workspace = true
|
||||||
egui.workspace = true
|
egui.workspace = true
|
||||||
|
egui_dock.workspace = true
|
||||||
|
egui_tracing.workspace = true
|
||||||
encase.workspace = true
|
encase.workspace = true
|
||||||
image.workspace = true
|
image.workspace = true
|
||||||
imageproc.workspace = true
|
imageproc.workspace = true
|
||||||
itertools.workspace = true
|
itertools.workspace = true
|
||||||
|
libblur.workspace = true
|
||||||
nalgebra.workspace = true
|
nalgebra.workspace = true
|
||||||
notify-rust.workspace = true
|
notify-rust.workspace = true
|
||||||
open.workspace = true
|
open.workspace = true
|
||||||
@@ -29,8 +30,8 @@ plexus.workspace = true
|
|||||||
rand.workspace = true
|
rand.workspace = true
|
||||||
rayon.workspace = true
|
rayon.workspace = true
|
||||||
rfd.workspace = true
|
rfd.workspace = true
|
||||||
serde_json.workspace = true
|
|
||||||
serde.workspace = true
|
serde.workspace = true
|
||||||
|
serde_json.workspace = true
|
||||||
toml.workspace = true
|
toml.workspace = true
|
||||||
tracing-subscriber.workspace = true
|
tracing-subscriber.workspace = true
|
||||||
tracing.workspace = true
|
tracing.workspace = true
|
||||||
|
@@ -1,4 +1,5 @@
|
|||||||
use egui::{Context, Ui};
|
use egui::{Context, Ui};
|
||||||
|
use libblur::{EdgeMode, FastBlurChannels, ThreadingPolicy};
|
||||||
use rayon::iter::{ParallelBridge, ParallelIterator};
|
use rayon::iter::{ParallelBridge, ParallelIterator};
|
||||||
use slicer::format::FormatSliceFile;
|
use slicer::format::FormatSliceFile;
|
||||||
|
|
||||||
@@ -32,7 +33,17 @@ impl Plugin for AntiAliasPlugin {
|
|||||||
}
|
}
|
||||||
|
|
||||||
file.iter_mut_layers().par_bridge().for_each(|mut layer| {
|
file.iter_mut_layers().par_bridge().for_each(|mut layer| {
|
||||||
*layer = imageproc::filter::gaussian_blur_f32(&layer, self.radius);
|
let (width, height) = (layer.width(), layer.height());
|
||||||
|
libblur::fast_gaussian_next(
|
||||||
|
&mut layer,
|
||||||
|
width,
|
||||||
|
width,
|
||||||
|
height,
|
||||||
|
self.radius as u32,
|
||||||
|
FastBlurChannels::Plane,
|
||||||
|
ThreadingPolicy::Adaptive,
|
||||||
|
EdgeMode::Clamp,
|
||||||
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Reference in New Issue
Block a user