Hide stroke in 3D scatter using Makie.jl

Compare the two scatter plots produced by GLMakie in 2D and 3D:

scatter(rand(1000), rand(1000))

scatter(rand(1000), rand(1000), rand(1000))

image

Is there an option to hide the white stroke around the dots in 3D? When the cloud of points is very dense these strokes end up hiding the actual colors of the dots.

I tried playing with strokewidth, strokecolor, glowwidth, glowcolor, … but none of these options change the plot in 3D.

They are not strokes, they are rendering artifacts of the antialiasing. When a dot in front gets a half-transparent edge mixed with white background then it can block dots from behind that are rendered later from showing through. I’ve always wondered if that can be avoided, maybe @sdanisch or @ffreyer know

Thank you @jules, I imagined it was something like that. It would be nice to be able to hide these side effects.

1 Like

You can trade this problem for incorrect render order with overdraw = true or for some amount of transparency with transparency = true.

We could look into drawing markers without anti-aliasing and use fxaa to approximate it later. This might be pretty bad if things get small though, i.e. with text, thin stroke, thin linewidths (lines has the same problem) or very small markers. So it would need to be an adjustable option.

2 Likes

Thank you @ffreyer,overdraw=true solves the problem.

I worked on two more ways to treat this problem in GLMakie, which now got merged and will be available in Makie 0.20.3+. There is also a new subsection about this in the scatter docs: scatter · Makie

To summarize the new features:

  • Setting fxaa = true now replaces the native anti-aliasing with fxaa, which degrades marker quality but entirely removes the edge artifacts. Good if big markers without fine lines.
  • Setting depthsorting = true results in markers being sorted on the CPU side before rendering. This removes the problem between markers of the same scatter call without degrading quality, but doesn’t find the problem when other objects are involved. (Plot order may help here)
3 Likes

Wonderful - I tried these options and they are super useful to professionalize my scatter plots. Thanks!