New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Scatter in GLMakie: overdraw
and LScene
axis
#3412
Comments
Thanks for the examples! Unfortunately, both options bring the marker to the data space, which I'd like to avoid. This would create more problems in terms of determining a suitable marker size and so on. Sure that fig = Figure()
ax = LScene(fig[1,1])
lines!(ax, [(1,0,0), (0,1,1)])
scatter!(ax, [(.5,.5,.5)]; markersize=100, depth_shift=0.01f0)
# brings to the back
fig = Figure()
ax = LScene(fig[1,1])
lines!(ax, [(1,0,0), (0,1,1)])
scatter!(ax, [(.5,.5,.5)]; markersize=100, depth_shift=-0.01)
# does not work, maybe because it's f64 not f32? But does not reset it either; still in the back
fig = Figure()
ax = LScene(fig[1,1])
lines!(ax, [(1,0,0), (0,1,1)])
scatter!(ax, [(.5,.5,.5)]; markersize=100, depth_shift=-0.01f0)
# Now it's in the front
for depth in [-0.01f0, -0.01, 0.01, 0.01f0]
fig = Figure()
ax = LScene(fig[1,1])
lines!(ax, [(1,0,0), (0,1,1)])
scatter!(ax, [(.5,.5,.5)]; markersize=100, depth_shift=depth)
save("depth$depth.png", fig)
end
# same output 4 times, always in the front, wat? seems to depend on the last state before the loop. |
Ok maybe I should write my thoughts down a bit more.
I don't think you actually want that, because CairoMakie fully ignores depth from one plot object to the next. So if you just draw lots of markers and lines one or the other will be in front:
I'm assuming what you actually want is for markers to be in front of the line segment they relate to, but not globally. So if there is another line that's closer to the viewer/camera I'm assuming you'd want that to still plot over the marker. To get that behavior you'd need to find the lowest depth of the line in the area of the marker/circle and put the marker at that depth. With this example If you rotate the camera the depth value you need changes. This is more or less the worst case: Makie.project(ax.scene.camera, :data, :clip, Vec3f(0, 1, 1))[3] # 0.8039375
Makie.project(ax.scene.camera, :data, :clip, Vec3f(0.5))[3] # 0.8953843
Makie.project(ax.scene.camera, :data, :clip, Vec3f(1, 0, 0))[3] # 0.9442493 so you'd need to shift the marker by about -0.1 to get in front of the full line. But then it's also going to be in front of everything else that's behind the end point of this line, like labels, other lines, etc. If everything is the same color that's probably fine but then I think you actually just want to get rid of the artifacts around the lines, i.e. #3408 / https://discourse.julialang.org/t/hide-stroke-in-3d-scatter-using-makie-jl/106383? Because without those you can't tell what's in front: (no shift) And if you do want to use more than one color, then you're going to have issues with arrow markers being in front of other objects that should be in front of the marker. And you also have to do a bunch of back-and-forth transforming to figure out how much shifting you need. That's probably going to be more expensive than some heuristic for finding an acceptable markersize for meshscatter or scatter.
That's going to get you to the CairoMakie case but you may run into issues with markers getting clipped earlier than you want to, because on
Yea that might be missing a convert_attribute
Weird, maybe there is some screen reuse going on that's messing with typing as well?
Setting |
In 3D plots in
GraphMakie
, we overlay the line-segments based edge plot with scatter plots containing node and edge-arrow markers like this:In
GLMakie
this looks a bit weird because of the dept effect of the flat sprites:scatter!(...; depth_shift=x)
changes nothing andweirdly interacts with the LScene axis
Any ideas on whats happening here and how to achieve the CairoMakie-look?
The text was updated successfully, but these errors were encountered: