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 naive depth sorting for scatter & text #3432

Merged
merged 3 commits into from Dec 18, 2023
Merged

Add naive depth sorting for scatter & text #3432

merged 3 commits into from Dec 18, 2023

Conversation

ffreyer
Copy link
Collaborator

@ffreyer ffreyer commented Nov 29, 2023

Description

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

Sort of an alternative to #3408.

Adds depthsorting::Bool which results in sorting of markers in GLMakie when true. This fixes artifacts for markers coming from one plot call

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

but still produces them when other plot calls are involved: (second example involves 2 scatter plots)

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

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

Unlike #3408 this does not degrade the quality of markers though, so it might be preferable in some situations

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 29, 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.37, 3.52) 0.06+- 404.37ms (396.29, 419.51) 9.17+- 478.17ms (465.13, 513.17) 16.52+- 7.46ms (7.31, 7.83) 0.18+- 25.38ms (25.28, 25.50) 0.08+-
master 3.44s (3.39, 3.51) 0.05+- 378.87ms (308.75, 401.41) 31.53+- 469.64ms (464.73, 475.18) 3.83+- 7.47ms (7.31, 7.60) 0.11+- 25.52ms (25.33, 25.81) 0.19+-
evaluation 1.00x invariant, -0.01s (-0.21d, 0.70p, 0.05std) 0.94x noisy🤷‍♀️, 25.51ms (1.10d, 0.08p, 20.35std) 0.98x invariant, 8.53ms (0.71d, 0.23p, 10.17std) 1.00x invariant, -0.01ms (-0.04d, 0.94p, 0.15std) 1.01x invariant, -0.14ms (-0.94d, 0.12p, 0.14std)
CairoMakie 3.24s (3.20, 3.31) 0.04+- 375.05ms (349.84, 411.92) 19.71+- 163.07ms (152.71, 175.54) 9.30+- 8.52ms (8.29, 8.79) 0.19+- 619.95μs (615.00, 623.25) 2.64+-
master 3.23s (3.17, 3.31) 0.06+- 372.26ms (360.38, 397.02) 11.74+- 164.86ms (159.20, 172.53) 5.66+- 8.67ms (8.23, 9.12) 0.28+- 622.01μs (616.39, 629.58) 5.02+-
evaluation 1.00x invariant, 0.01s (0.25d, 0.65p, 0.05std) 0.99x invariant, 2.79ms (0.17d, 0.75p, 15.73std) 1.01x invariant, -1.8ms (-0.23d, 0.67p, 7.48std) 1.02x invariant, -0.15ms (-0.60d, 0.28p, 0.24std) 1.00x invariant, -2.06μs (-0.51d, 0.36p, 3.83std)
WGLMakie 3.69s (3.64, 3.73) 0.04+- 319.88ms (316.35, 325.72) 3.46+- 8.62s (8.51, 8.69) 0.07+- 9.64ms (9.38, 10.61) 0.43+- 71.32ms (67.29, 80.94) 4.79+-
master 3.69s (3.65, 3.75) 0.03+- 322.56ms (318.15, 332.05) 4.88+- 8.63s (8.51, 8.75) 0.08+- 9.33ms (9.22, 9.43) 0.08+- 70.85ms (67.67, 77.53) 3.97+-
evaluation 1.00x invariant, 0.0s (0.01d, 0.98p, 0.04std) 1.01x invariant, -2.68ms (-0.63d, 0.26p, 4.17std) 1.00x invariant, -0.01s (-0.12d, 0.83p, 0.07std) 0.97x invariant, 0.31ms (1.01d, 0.11p, 0.25std) 0.99x invariant, 0.47ms (0.11d, 0.84p, 4.38std)

@ffreyer ffreyer changed the base branch from master to ff/fxaa December 1, 2023 19:28
@ffreyer ffreyer marked this pull request as ready for review December 18, 2023 13:18
@ffreyer ffreyer merged commit 64d68b4 into ff/fxaa Dec 18, 2023
@ffreyer ffreyer deleted the ff/depthsorting branch December 18, 2023 13:18
SimonDanisch added a commit that referenced this pull request Dec 21, 2023
* prototype fxaa mode

* same for lines

* update news

* add refimg test

* add docs examples/notes

* Add naive depth sorting for scatter & text (#3432)

* add naive depth sorting for scatter & text

* add depthsorting docs

* update news

* test depthsorting too

---------

Co-authored-by: Simon <sdanisch@protonmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants