-
-
Notifications
You must be signed in to change notification settings - Fork 352
Open
Labels
Description
I'm trying to display a mesh together with a volume, see the following MWE.
I cannot make the two display correctly together (here the sphere ends up either behind or in front of the volume, but not half inside and half outside as it should be). It's hard to see on the pictures, but try the MWE and rotate the figure to see what I mean.
using GLMakie
using NIfTI
# From the example given in the mesh docs
brain = niread(Makie.assetpath("brain.nii.gz")).raw
mini, maxi = extrema(brain)
normed = Float32.((brain .- mini) ./ (maxi - mini))
fig = Figure(size=(1000, 450))
ax = Axis3(fig[1, 1])
# Make a colormap, with the first value being transparent
colormap = to_colormap(:plasma)
colormap[1] = RGBAf(0, 0, 0, 0)
volume!(ax, normed, algorithm=:absorption, absorption=4f0, colormap=colormap)
# Add a sphere (make it half inside, half outside the brain)
s = Sphere(Point3f(100, 100, 100), 100f0)
mesh!(ax, s)
wireframe!(ax, s)
fig
I guess it's due to the absorption algorithm that does not take the mesh into account. I tried playing with various options such as transparency or depth shift to no avail. Is this the expected behaviour? If so, is there a way to achieve this kind of visualization?


Thanks!