Skip to content

Antialias fills without gl.LINES #2080

Open

Description

@ansis

The minimum ALIASED_LINE_WIDTH_RANGE required by the spec is [1, 1]. We need at least a width of 2 for antialiasing to work. ANGLE only supports a width of 1. Angle is used in Chrome and Firefox on windows, and by our headless testing.

We should use triangles.

moving away from gl.LINES should fix #1047

It could also help without our headless testing antialiasing headaches.

Activity

  1. ansis commented on Feb 6, 2016

    @ansis
    ContributorAuthor
  2. lucaswoj commented on Feb 8, 2016

    @lucaswoj
    Contributor

    Do you think this is the same phenomena as #1606 (comment)?

  3. changed the title [-]antialias fills without gl.LINES[/-] [+]Antialias fills without gl.LINES[/+] on Jul 29, 2016
  4. tmpsantos commented on Jun 22, 2017

    @tmpsantos
    Contributor

    ANGLE is also used on Mapbox GL Native + Qt on Windows.

  5. jfirebaugh commented on Jun 26, 2017

    @jfirebaugh
    Contributor
  6. jfirebaugh commented on Jul 17, 2017

    @jfirebaugh
    Contributor

    @kkaefer pointed out a potential technique for doing polygon antialiasing/stroking using barycentric coordinates, and I spent some time prototyping it in gl-js. It's a clever technique, but unfortunately it doesn't look like it will work for us. The technique originates as a way of drawing wireframes, where all three sides of each triangle are stroked. When you want to stroke only some of the sides, the issue arises that the edges that are not stroked end up "cutting off" pieces of the stroke on adjacent edges:

    image

    The skinnier the triangles, the worse this gets -- and earcut tends to generate a lot of very skinny triangles.

    You could try to correct for this by shading portions of the other triangles that cover that border, but this doesn't seem straightforward, and I couldn't find any papers or threads online that discussed it.

    A second issue with this technique is that it will only allow us to antialias or stroke the interior of the polygon. An interior-only antialiasing would likely produce or exacerbate seams between polygons that share an edge. What we really want is a 50/50 split between the interior and exterior, and to get that, we'd need to implement polygon outset, a complex algorithm.

  7. exotfboy commented on May 24, 2018

    @exotfboy

    Hi , I found that the Antialias also does not work with the fill-extrusion.

    image

  8. alphex commented on Oct 25, 2022

    @alphex

    I'm suffering from this issue also.
    I found that setting a 1px stroke with 50% opacity of the same color solved the issue... but .. yeah, doesn't work as advertised.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions