Skip to content
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

Add options to reduce edge artifacts in scatter (text, lines) #3408

Merged
merged 11 commits into from Dec 21, 2023

Conversation

ffreyer
Copy link
Collaborator

@ffreyer ffreyer commented Nov 23, 2023

Description

Fixes/Improves https://discourse.julialang.org/t/hide-stroke-in-3d-scatter-using-makie-jl/106383

Adjusts the shader to not do AA via sdf data when fxaa = true. This avoids generating transparent pixels from AA, which generate artifacts based on render order.

So it allows you to get rid of white outlines in 3D scatters
Screenshot from 2023-11-23 16-31-08
at the cost of marker quality/detail
Screenshot from 2023-11-23 16-22-16
by setting fxaa = true.


From #3432:

Adds depthsorting::Bool as a hidden attribute. Setting it to true results in scatter markers getting sorted on the CPU, making them render in a non-artifacting order:

Screenshot from 2023-11-29 17-46-03

This only works between markers of the same plot call. If markers from another scatter call or another plot object is involved artifacts may reappear. Unlike the fxaa solution this does not degrade quality though:

Screenshot from 2023-11-29 17-55-03

Screenshot from 2023-11-29 17-58-15

Type of change

  • New feature (non-breaking change which adds functionality)

Checklist

  • Added an entry in NEWS.md (for new features and breaking changes)
  • Added or changed relevant sections in the documentation
  • Added unit tests for new algorithms, conversion methods, etc.
  • Added reference image tests for new plotting functions, recipes, visual options, etc.

@MakieBot
Copy link
Collaborator

MakieBot commented Nov 23, 2023

Compile Times benchmark

Note, that these numbers may fluctuate on the CI servers, so take them with a grain of salt. All benchmark results are based on the mean time and negative percent mean faster than the base branch. Note, that GLMakie + WGLMakie run on an emulated GPU, so the runtime benchmark is much slower. Results are from running:

using_time = @ctime using Backend
# Compile time
create_time = @ctime fig = scatter(1:4; color=1:4, colormap=:turbo, markersize=20, visible=true)
display_time = @ctime Makie.colorbuffer(display(fig))
# Runtime
create_time = @benchmark fig = scatter(1:4; color=1:4, colormap=:turbo, markersize=20, visible=true)
display_time = @benchmark Makie.colorbuffer(fig)
using create display create display
GLMakie 3.43s (3.39, 3.49) 0.03+- 381.10ms (377.65, 392.43) 5.12+- 472.56ms (466.76, 493.98) 9.69+- 7.18ms (7.03, 7.38) 0.14+- 25.33ms (25.25, 25.56) 0.11+-
master 3.39s (3.36, 3.46) 0.03+- 385.04ms (372.11, 397.89) 10.02+- 463.18ms (449.55, 504.71) 18.93+- 7.05ms (6.99, 7.14) 0.05+- 25.47ms (25.23, 25.82) 0.23+-
evaluation 0.99x slower X, 0.04s (1.22d, 0.04p, 0.03std) 1.01x invariant, -3.94ms (-0.50d, 0.38p, 7.57std) 0.98x invariant, 9.38ms (0.62d, 0.27p, 14.31std) 0.98x invariant, 0.12ms (1.16d, 0.06p, 0.10std) 1.01x invariant, -0.14ms (-0.79d, 0.18p, 0.17std)
CairoMakie 3.15s (3.07, 3.28) 0.09+- 327.08ms (316.26, 355.27) 16.60+- 144.93ms (139.98, 156.65) 6.78+- 7.82ms (7.48, 8.54) 0.37+- 615.88μs (608.81, 623.61) 5.62+-
master 3.19s (3.08, 3.28) 0.09+- 334.06ms (315.17, 363.87) 20.94+- 148.50ms (139.12, 161.19) 9.11+- 7.83ms (7.51, 8.28) 0.30+- 608.79μs (601.48, 617.37) 4.98+-
evaluation 1.01x invariant, -0.04s (-0.46d, 0.40p, 0.09std) 1.02x invariant, -6.98ms (-0.37d, 0.50p, 18.77std) 1.02x invariant, -3.57ms (-0.44d, 0.42p, 7.94std) 1.00x invariant, -0.01ms (-0.04d, 0.94p, 0.33std) 0.99x slower X, 7.09μs (1.34d, 0.03p, 5.30std)
WGLMakie 3.72s (3.68, 3.75) 0.03+- 319.55ms (310.34, 327.82) 6.01+- 8.64s (8.56, 8.84) 0.09+- 9.39ms (9.08, 10.39) 0.46+- 74.19ms (67.32, 86.46) 7.05+-
master 3.79s (3.71, 3.84) 0.05+- 329.15ms (318.28, 333.57) 5.50+- 8.90s (8.58, 9.56) 0.34+- 9.44ms (9.03, 10.08) 0.37+- 70.41ms (67.65, 76.36) 3.47+-
evaluation 1.02x faster ✓, -0.07s (-1.53d, 0.02p, 0.04std) 1.03x faster ✓, -9.6ms (-1.67d, 0.01p, 5.76std) 1.03x invariant, -0.26s (-1.05d, 0.09p, 0.22std) 1.01x invariant, -0.05ms (-0.12d, 0.83p, 0.42std) 0.95x noisy🤷‍♀️, 3.78ms (0.68d, 0.24p, 5.26std)

@ffreyer ffreyer changed the title Add fxaa mode to scatter (text, lines) Add options to reduce edge artifacts in scatter (text, lines) Dec 20, 2023
@ffreyer ffreyer added the GLMakie This relates to GLMakie.jl, the OpenGL backend for Makie. label Dec 20, 2023
@SimonDanisch SimonDanisch merged commit 2f9b798 into master Dec 21, 2023
16 checks passed
@SimonDanisch SimonDanisch deleted the ff/fxaa branch December 21, 2023 13:25
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
GLMakie This relates to GLMakie.jl, the OpenGL backend for Makie.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants