# How to unsmooth GLMakie volume plot?

Hi, I’m working with 3d voxels data and want to use volume function from GLMakie.
I noticed that visualized volume is kind of smoothed/averaged. For example, code for one voxel inside cube is:

``````julia> using GLMakie

julia> volume([0; 0; 0;; 0; 0; 0;; 0; 0; 0;;;
0; 0; 0;; 0; 1; 0;; 0; 0; 0;;;
0; 0; 0;; 0; 0; 0;; 0; 0; 0];)
``````

I expected view of sharp voxel with distincted cube edges, but get image as below

I tried different arguments and cant figure out how to make plot as one sharp voxel inside cube.
So my question is there way to make it sharp?
Thank you!!!

Check Meshes.jl viz recipe function. It does what you want:

``````using Meshes

import GLMakie as Mke

grid = CartesianGrid(10, 10, 10)

viz(grid, color = 1:1000)
``````

2 Likes

You can use the iso algorithm:

``````using GLMakie

volume([0; 0; 0;; 0; 0; 0;; 0; 0; 0;;;
0; 0; 0;; 0; 1; 0;; 0; 0; 0;;;
0; 0; 0;; 0; 0; 0;; 0; 0; 0]; algorithm=:iso, isovalue=0.05)
``````

Which is documented here: volume · Makie

2 Likes

@ juliohm and sdanisch thanks for answering! May be my description was unclear. I dont need only voxel (cube) it was just minimal toy example. In reality volume will be with high number of voxels and different intensity of each voxel, CT like images. More real example:

But on more real volume is harder to explaing smoothing effect.
Anyway, just out of curisity as I understend clear MIP algorithm should not provide such smoothing effect or I’m wrong?

You mean it should like this without interpolation?

I guess we could add that as an option…

1 Like

Yes. It would be great to have option for turning off the intepolation.

@xinady have you seen the `alpha` transparency option of the `viz` recipe above? Is that what you want?

Additional resource: Geospatial Data Science with Julia - 2  Scientific visualization

We are calling `Makie.meshscatter` in the 3D case. You can also try to convert the grid into a simple mesh with `convert(SimpleMesh, grid)` before plotting and that will call the `Makie.mesh` recipe instead.