A few years back I asked a question, that I could not fully resolve. At JuliaCon I think I heard it is now possible, so I’ll give it a new try. If I do something like (e.g. in a Pluto cell)
begin
using WGLMakie, Colors, Manifolds #versions 0.10.5, 0.12.11, 0.9.20
# A sphere
n = 45
u = range(0,stop=2*π,length=n);
v = range(0,stop=π,length=n);
sx = zeros(n,n); sy = zeros(n,n); sz = zeros(n,n)
for i in 1:n
for j in 1:n
sx[i,j] = cos.(u[i]) * sin(v[j]);
sy[i,j] = sin.(u[i]) * sin(v[j]);
sz[i,j] = cos(v[j]);
end
end
fig, ax, plt = surface(
sx,sy,sz,
color = fill(RGBA(1.,1.,1.,0.3), n, n),
shading = Makie.automatic
)
ax.show_axis = false
wireframe!(ax, sx, sy, sz, color = RGBA(0.5,0.5,0.7,0.3))
# Scatter some points
π1(x) = x[1]
π2(x) = x[2]
π3(x) = x[3]
M = Manifolds.Sphere(2)
pts = [rand(M) for _ in 1:300]
scatter!(ax, π1.(pts), π2.(pts), π3.(pts); markersize=4, color=:blue)
fig
end
I get an image like
What I would love to have is actual transparency, From the 300 points some are also on the back of the sphere – and just seeing them shining through would be great. If they were for example a curve, one could easily see which part is upfront, which behind.
Is that doable in Makie? I already do use transparency in the color, that does not seem to do the job here.