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

GLMakie lines TODO #2548

Open
ffreyer opened this issue Jan 3, 2023 · 4 comments
Open

GLMakie lines TODO #2548

ffreyer opened this issue Jan 3, 2023 · 4 comments

Comments

@ffreyer
Copy link
Collaborator

ffreyer commented Jan 3, 2023

As I'm working on #2536 I keeping finding little issues and things we should add or change

  1. Solid lines are only anti-aliased along their width, but not their length (i.e. the ends aren't anti-aliased) Fixed by [GLMakie] Cleanup linestyles #2666
  2. Solid (probably all) lines overlap themselves when corners are sharp enough
  3. Since I'm adding linecaps in add linecaps (GLMakie, CairoMakie) #2536 we should also add joint styles. Options should include round, sharp corner via projecting (we do this for small changes in line direction), cut off corners (we do this for large changes in direction) and the "smart" version we have atm
  4. poly picks the first method definition
    function plot!(plot::Poly{<: Tuple{Union{GeometryBasics.Mesh, GeometryPrimitive}}})
    for Rect, which means it relies on wireframe which uses linesegments. So it will always produce bad corners (fully overlapping, partially overlapping or missing corners). We should make it go into the second method
    function plot!(plot::Poly{<: Tuple{<: Union{Polygon, AbstractVector{<: PolyElements}}}})
    to produce at least 3 clean corners via lines
  5. We should add a way to draw closed lines to avoid the last overlapping corner. This might require some adjustments to joints, so do it with (3)
  6. Non-solid lines sometimes produce artifacts Fixed by [GLMakie] Cleanup linestyles #2666
  7. Non-solid lines have irregular spacing, especially on curved lines Fixed by [GLMakie] Cleanup linestyles #2666
  8. Lines produce artifacts on other objects with fxaa = true
  9. A very short line creates downward artifacts on a 90° turn Duplicate of Rendering of stairs plot is distorted when zoomed out #1129, improved by [GLMakie] Cleanup linestyles #2666, and further improved by Fix lines #2843

Example (1), (2)

This is the miter joints test image from GLMakie

Screenshot from 2023-01-03 17-25-11

Example (4)

On master:

scene = Scene()
poly!(scene, Rect2f(-0.8, -0.8, 1.6, 1.6), color = :transparent, strokewidth = 10, strokecolor = (:black, 0.5))

Screenshot from 2023-01-03 17-47-33

Example (6)

On master. These artifacts get more or less pronounced when the line is moved around.

scene = Scene()
lines!(scene, [-1,0,1], [0,0,0], linestyle = :dot, linewidth = 20)

Screenshot from 2023-01-03 17-42-06

Example (7)

This is from the linecaps pr, which is already better than master but still has issues with this

lines(range(0, 2pi, length=31), sin, linestyle = :dash, linewidth=5)

Screenshot from 2023-01-02 13-45-05

Example (8)

This is from a random crossbar with the center line drawn

Screenshot from 2023-01-03 17-36-16

Example (9)

On master this generates artifacts depending on the y zoom level

lines([0, 1, 2, 2, 0], [0, 1, 0.01, 0, 0], linewidth = 10)

Screenshot from 2023-01-03 19-55-17 Screenshot from 2023-01-03 19-55-23

@jkrumbiegel
Copy link
Collaborator

We should add a way to draw closed lines to avoid the last overlapping corner

+1 for that from me, currently in CairoMakie this is just done if the last point of a line is equal to the first. I just decided to go with that at the time even though it's not "official" behavior because too often it's what should happen anyway.

@SimonDanisch
Copy link
Member

How much is fixed of this now?

@ffreyer
Copy link
Collaborator Author

ffreyer commented Apr 27, 2023

What I crossed out in the list should still be up to date

@ffreyer
Copy link
Collaborator Author

ffreyer commented Apr 27, 2023

I think the self-overlap (2) isn't something we can fix without another full rewrite. (Possibly switching to a two pass line rendering solution, where we render line opaque first, so the overlap doesn't matter and apply transparency in a second step when merging with the main buffer.)

I had some notes on closed lines (5) here: #2666 (comment) Should be relatively easy, but requires adding extra points.

(8) requires a different fxaa solution which I don't really see happening anytime soon.

@ffreyer ffreyer mentioned this issue Feb 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: No status
Development

No branches or pull requests

3 participants