From f95161c53ba1da07952efb1bb4297d88ab29f7c1 Mon Sep 17 00:00:00 2001 From: SimonDanisch Date: Mon, 18 Dec 2023 15:41:30 +0100 Subject: [PATCH 1/2] add interpolate option to volume --- GLMakie/src/drawing_primitives.jl | 7 +++++-- MakieCore/src/basic_plots.jl | 3 ++- 2 files changed, 7 insertions(+), 3 deletions(-) diff --git a/GLMakie/src/drawing_primitives.jl b/GLMakie/src/drawing_primitives.jl index 9fa55f52b8e..33773b5921c 100644 --- a/GLMakie/src/drawing_primitives.jl +++ b/GLMakie/src/drawing_primitives.jl @@ -802,11 +802,14 @@ function draw_atomic(screen::Screen, scene::Scene, plot::Volume) ) return convert(Mat4f, m) * m2 end + interp = to_value(pop!(gl_attributes, :interpolate)) + interp = interp ? :linear : :nearest + Tex(x) = Texture(x; minfilter=interp) if haskey(gl_attributes, :intensity) intensity = pop!(gl_attributes, :intensity) - return draw_volume(screen, intensity, gl_attributes) + return draw_volume(screen, Tex(intensity), gl_attributes) else - return draw_volume(screen, plot[4], gl_attributes) + return draw_volume(screen, Tex(plot[4]), gl_attributes) end end end diff --git a/MakieCore/src/basic_plots.jl b/MakieCore/src/basic_plots.jl index f0905cac58e..cc09c0d620b 100644 --- a/MakieCore/src/basic_plots.jl +++ b/MakieCore/src/basic_plots.jl @@ -192,6 +192,7 @@ Available algorithms are: - `algorithm::Union{Symbol, RaymarchAlgorithm} = :mip` sets the volume algorithm that is used. - `isorange::Real = 0.05` sets the range of values picked up by the IsoValue algorithm. - `isovalue = 0.5` sets the target value for the IsoValue algorithm. +- `interpolate::Bool = true` sets whether the volume data should be sampled with interpolation. $(Base.Docs.doc(shading_attributes!)) @@ -205,7 +206,7 @@ $(Base.Docs.doc(MakieCore.generic_plot_attributes!)) algorithm = :mip, isovalue = 0.5, isorange = 0.05, - + interpolate = true, fxaa = true, ) generic_plot_attributes!(attr) From 92eedd29d6c38042270ab4088764a6e9db8aa5c0 Mon Sep 17 00:00:00 2001 From: SimonDanisch Date: Mon, 18 Dec 2023 15:44:50 +0100 Subject: [PATCH 2/2] update news --- NEWS.md | 1 + 1 file changed, 1 insertion(+) diff --git a/NEWS.md b/NEWS.md index 711ffb4b225..9210c5c9106 100644 --- a/NEWS.md +++ b/NEWS.md @@ -4,6 +4,7 @@ - DataInspector Fixes: Fixed depth order, positional labels being in transformed space and `:inspector_clear` not getting called when moving from one plot to another. [#3454](https://github.com/MakieOrg/Makie.jl/pull/3454) - Fixed bug in GLMakie where the update from a (i, j) sized GPU buffer to a (j, i) sized buffer would fail [#3456](https://github.com/MakieOrg/Makie.jl/pull/3456). +- Add `interpolate=true` to `volume(...)`, allowing to disable interpolation [#3485](https://github.com/MakieOrg/Makie.jl/pull/3485). ## 0.20.2