Hi, I’ve been using Julia and the Plots package for a while, but only recently have tried using Makie for some visualizations, and ran into some problems. No matter what I try, I can’t get line segments to play nicely with transparent surfaces or with volumes.
As an MWE, if I make a simple surface and put line segments above and below it, I get what I would expect
using Makie
scene = Scene()
y = collect(-10:0.1:10)
x = y
z = zeros(length(x), length(y))
height = 5.0
x0 = 0.0
y0 = 0.0
z0 = 0.0
origin = Point3f0(x0, y0, height)
crosspt = Point3f0(x0, y0, z0)
finalpt = Point3f0(x0-2 ,y0+2, -height)
line1 = [origin, crosspt]
line2 = [crosspt, finalpt]
linesegments!(scene, line1, linewidth=5, color=:red,)
linesegments!(scene, line2, linewidth=5, color=:red,)
surface!(scene, x, y, z, shading=false)
But if I change the last line to make the surface partially transparent as
surface!(scene, x, y, z, alpha=0.95, transparency=true, shading=false)
it draws the line as if the surface was completely transparent.
I have tried several variations of this (including changing the plotting order). Searching the forums I saw it suggested that alpha didn’t work correctly, so I attempted replacing the surface with meshes using explicit colors,
mesh!(scene, [-10,-10,10], [-10, 10, -10], [0,0,0], color=(:purple, 0.95), transparency=true, shading=false)
mesh!(scene, [-10,10, 10], [10, -10, 10], [0,0,0], color=(:purple, 0.95), transparency=true, shading=false)
but I get the same result.
Looking closely it seems the lines from the axis/grid also get drawn over the surface. Am I missing something about how transparency is supposed to work, or does it fundamentally not work with lines in Makie?
I am hoping someone in the community has some idea whats going on here. Thanks in advance.