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

Fix Axis3 frameline z-sorting in CairoMakie #4591

Merged
merged 2 commits into from
Nov 15, 2024
Merged

Conversation

ffreyer
Copy link
Collaborator

@ffreyer ffreyer commented Nov 14, 2024

Description

#4485 changed zvalue2d to read transformation.model instead of transformation.translation, which causes it to include changes made to model directly. Axis3 does that, so the results of plots under ax.scene changed.

A few cases:

  • Frame lines are part of the ax.blockscene so they don't see the model change from Axis3. Instead of getting translated, they have their input shifted. So before and after they have zvalue2d() = 0.
  • Plots added to an Axis3 end up in ax.scene. Previously they had a default translation of 0, now some other value based on the scenes model matrix. Since the scene centers its 3d boundingbox around 0, plots that have positive z values get shifted back and thus get a zvalue2d < 0
  • Grid lines are also drawn to ax.scene and experience the same change as user plots. They end up at the same z value as them but earlier in the scene.plots array, so they draw first.

This pr should undo the change introduced in #4485 for CairoMakie by translating the frame lines plot instead of setting their data z-value to -10k.

Type of change

  • Bug fix (non-breaking change which fixes an issue)

Checklist

  • Added an entry in CHANGELOG.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

Benchmark Results

SHA: 32e8ced5146e6eac207f8c932f1df07be0aba766

Warning

These results are subject to substantial noise because GitHub's CI runs on shared machines that are not ideally suited for benchmarking.

GLMakie
CairoMakie
WGLMakie

@ffreyer
Copy link
Collaborator Author

ffreyer commented Nov 14, 2024

Tests look good to me, can be merged

@ffreyer
Copy link
Collaborator Author

ffreyer commented Nov 14, 2024

Maybe worth noting that the z sorting we are doing only makes sense in 2D, where z translates to directly to depth. In 3D projectionview will generally rotate space for that to not be true. It also acts on a different scale and input data matters. (Even in 2D it sometimes does, see this pr.)
The plot update refactor could help with this by making boundingbox caching cheaper and allowing us to fully transform that. #4150 could also help since it aims to render scene by scene, thus also making the z-sorting per scene. With that we could disable it in 3D.

@ffreyer ffreyer merged commit 66c32da into master Nov 15, 2024
@ffreyer ffreyer deleted the ff/Axis3-frame-fix branch November 15, 2024 15:44
@ffreyer ffreyer mentioned this pull request Nov 15, 2024
5 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: Merged
Development

Successfully merging this pull request may close these issues.

3 participants