Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Lines TODO #3641

Closed
ffreyer opened this issue Feb 19, 2024 · 0 comments
Closed

Lines TODO #3641

ffreyer opened this issue Feb 19, 2024 · 0 comments
Labels
bug Collection contains multiple issues enhancement Feature requests and enhancements planning For discussion and planning development

Comments

@ffreyer
Copy link
Collaborator

ffreyer commented Feb 19, 2024

This supersedes #2548 and closes it once #3558 gets merged.


New Features

Joinstyle and linecap (from #2548 & #3558)

Rounded joints, caps and extruded caps should be much easier with the added signed distance fields. We just need to adjust their interpretation.

Closed Lines / Loops (from #2548)

Add a keyword that makes lines closed loops. This would require adjusting indices + shaders to cleanly connect the line.

Bring back per-point linewidth (from #3558)

This is getting removed in #3558 as it complicates things a lot. With a large difference in linewidth the shape of the line segment can become concave, which makes the signed distance fields cut away from sections they should not affect. A potential way to deal with this is to detect concave corners and switch max(width, length) to min(width, length) for them.

Bug fixes / Improvements

Poly Optimization (from #3558)

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

Optimize line length calculation/slow path (from #3558)

In order to correctly continue patterns from line segment to segment we need to calculate the cumulative line length on the CPU. Currently we always do a full transformation to pixel space. I think that is unnecessary when if the camera does not have perspective projection or at least if it does not have rotation.

Avoid bending dots across joints (from #3558)

In #3558 this can be done by setting offset = max(abs(extrusion, halfwidth) in process_pattern however that result in patterns breaking in dense lines (e.g. bracket tests). This might be fixable by limiting halfwidth to the segment length.

Sample colormap in fragment shader (from #3558)

Currently colormaps are sampled in the vertex/geometry shaders, which means that we interpolate colors directly rather than interpolating values and resampling the colormap. This leads wrong colors in some cases.

Fixed in #3558

Move line length calculation to JavaScript in WGLMakie (from #3558)

WGLMakie artifacts in dense lines (from #3558)

In #3558 one of the tests shows artifacts:

Screenshot from 2024-02-13 19-26-06

I can't reproduce these directly, but I can get something similar with px_per_unit = 0.5. When rendering alpha >= 1 as black, alpha <= 0 as red and the in-between as green I get:

Screenshot from 2024-02-15 13-51-12

Based on this I'm assuming that the issue has something to do with MSAA as well. If two segments draw to the same pixel we should either see flat black, green or red. To get dark red pixels there needs to be mixing between alpha >= 1 and alpha <= 0, i.e. multisampling. It should also not be the case that the green and red outline sections get anti-aliased, but they do.

Probably won't fix (anytime soon)

Truncated joints overlap themselves (from #2548)

Removing this overlap is doable with the new signed distance field approach, but it's unclear how to handle lines that overlap across their whole length. For example, a short line cutting away from a longer may result in a missing section like this:
Screenshot from 2024-01-25 16-12-07
Cutting away up until the end of the shorter line is more difficult and will likely lead to further AA issues.

Line-fxaa issues in GLMakie (from #2548)

Lines produce artifacts on other objects with fxaa = true. This is a result of the fxaa masking we are doing. There is now a workaround (setting fxaa = true for the line) and a fix for this requires redoing our renderloop. So it's pretty low priority.

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

@ffreyer ffreyer added bug enhancement Feature requests and enhancements labels Feb 19, 2024
@ffreyer ffreyer added planning For discussion and planning development Collection contains multiple issues labels Aug 27, 2024
@MakieOrg MakieOrg locked and limited conversation to collaborators Aug 27, 2024
@ffreyer ffreyer converted this issue into discussion #4262 Aug 27, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
bug Collection contains multiple issues enhancement Feature requests and enhancements planning For discussion and planning development
Projects
None yet
Development

No branches or pull requests

1 participant