Skip to content

[Impeller] The geometry used for the SDF-based AA circle fragment clips some of its output #183418

Description

@flar

Customers have complained about the quality of our stroked AA circles, such as #182708.

In investigating how to fix those issues we discovered that the geometry used to constrain the SDF-based shader for circles may not include all of the pixels for which the shader produces non-transparent output. The geometry object tessellates the precise edges of the filled or stroked circles and only pixels (and MSAA samples) that are inside that geometry are processed. If just one MSAA sample for a given pixel falls in those vertices, but the rest of the MSAA samples for that pixel are outside it then we might have the shader compute the exact coverage for that pixel (which would be a small number) only to have the MSAA resolution divide it by the fraction of MSAA pixels covered and reduce that contribution estimation to nearly invisible values.

The fix would be to pad the geometry generated for both filled and stroked circles to include an extra pixel along their edges. Theoretically half a pixel might do it, but the algorithm would want full coverage for all pixels around the border so that the shader's carefully calculated contribution will not get further reduced if it misses an MSAA sample. For the filled geometry we should pad the radius by "1 device pixel". For the stroked geometry, we should pad the stroke width by 2 pixels (one for the inside and one for the outside).

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type
No fields configured for issues without a type.

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions