Skip to content

Adds documentation for antialiasing with impeller#13370

Draft
gaaclarke wants to merge 5 commits intoflutter:mainfrom
gaaclarke:antialias-doc
Draft

Adds documentation for antialiasing with impeller#13370
gaaclarke wants to merge 5 commits intoflutter:mainfrom
gaaclarke:antialias-doc

Conversation

@gaaclarke
Copy link
Copy Markdown
Member

@gaaclarke gaaclarke commented May 6, 2026

This PR should only be landed after macOS impeller is switched to SDFs by default: flutter/flutter#183045

Description

This explains SDF rendering for macOS and covers antialiasing in general. The main things to communicate is the escape hatch if people want to implement their own SDFs and how to opt-in to SDFs on mobile devices.

Issues fixed by this PR

flutter/flutter#183043

PRs or commits this PR depends on

flutter/flutter#183045

Presubmit checklist

  • If you are unwilling, or unable, to sign the CLA, even for a tiny, one-word PR, please file an issue instead of a PR.
  • If this PR is not meant to land until a future stable release, mark it as draft with an explanation.
  • This PR follows the Google Developer Documentation Style Guidelines—for example, it doesn't use i.e. or e.g., and it avoids I and we (first-person pronouns).
  • This PR uses semantic line breaks
    of 80 characters or fewer.

@flutter-website-bot
Copy link
Copy Markdown
Collaborator

flutter-website-bot commented May 7, 2026

Visit the preview URL for this PR (updated for commit 76cc499):

https://flutter-docs-prod--pr13370-antialias-doc-17a96hc6.web.app

@gaaclarke gaaclarke requested a review from andywolff May 7, 2026 16:45
Comment thread sites/docs/src/content/perf/antialiasing.md
Copy link
Copy Markdown

@andywolff andywolff left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Contents and location of the new doc make sense to me.

Copy link
Copy Markdown
Contributor

@sfshaza2 sfshaza2 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Some smoothing out and one question for @gaaclarke.

### Multisample anti-aliasing (MSAA)

[MSAA][] is a global anti-aliasing technique that operates on the whole contents
of the screen. It is an optimization over rendering the whole screen at a larger
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
of the screen. It is an optimization over rendering the whole screen at a larger
It's more optimized than rendering the whole screen at a larger

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The meaning I'm trying to convey is that this is a technique that is an optimization on supersampling. I'm spelling out supersampling though to try to make it more accessible. The suggestion loses that relationship.

Comment on lines +27 to +28
Typically, hardware accelerated computer graphics is done by defining a series
of points and edges (a [mesh][]) and [shaders][]. SDF rendering instead renders
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Typically, hardware accelerated computer graphics is done by defining a series
of points and edges (a [mesh][]) and [shaders][]. SDF rendering instead renders
Typically, hardware accelerated computer graphics define a series
of points and edges (as a [mesh][]) and [shaders][]). Instead, SDF renders

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done. I did keep "a mesh" though since it is defining the concept. It's not an example of how those things could be a collection.

Comment on lines +29 to +30
the shape of things in the fragment shader program using SDFs to define the
shape of the object being drawn. Since the shape is defined in the fragment
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
the shape of things in the fragment shader program using SDFs to define the
shape of the object being drawn. Since the shape is defined in the fragment
shapes in the fragment shader program as signed distance fields.
Since the shape is defined in the fragment

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment on lines +31 to +32
shader there is an opportunity to smooth out edges at the fragment level instead
of relying on the rasterization of a mesh.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
shader there is an opportunity to smooth out edges at the fragment level instead
of relying on the rasterization of a mesh.
shader, the edges can be smoothed at the fragment level instead
of relying on the rasterization of a mesh.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Comment on lines +34 to +35
On desktop, rendering with SDFs is enabled. On mobile platforms SDFs is an
option whose default value is false.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
On desktop, rendering with SDFs is enabled. On mobile platforms SDFs is an
option whose default value is false.
On desktop, rendering with SDFs is enabled. On mobile platforms,
SDF is an option that defaults to false.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done


### SDFs with the FragmentShader API

Standard primitive shapes in Flutter will be drawn automatically with SDFs. If
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
Standard primitive shapes in Flutter will be drawn automatically with SDFs. If
Standard primitive shapes in Flutter are drawn automatically with SDFs. If

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

a Flutter developer wants to define their own custom graphics with SDFs they can
do so with the [FragmentShader API][]. Using the [drawPath()][] is sufficient
for most use cases without resorting to high quality SDF rendering. Not all
drawn paths are guaranteed to result in SDF rendering though.
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we want to say more about this? Why might it be ignored even if disabled?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's the inverse of that, you have SDFs enabled but you aren't guaranteed to get them always. I'm sort of covering for the current limitations in the engine. It's an ongoing research problem. There will always be some frontier where it becomes impractical because of hardware limitations. I don't know if I want to wade into that.

---

Aliasing is the visual artifacts that result from drawing geometry to a grid of
pixels (rasterization). Impeller employs a couple of techniques to smooth out
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
pixels (rasterization). Impeller employs a couple of techniques to smooth out
pixels (rasterization). Impeller employs a couple techniques to smooth out

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

@sfshaza2 sfshaza2 added the review.await-update Awaiting Updates after Edits label May 7, 2026
@gaaclarke gaaclarke requested a review from sfshaza2 May 7, 2026 22:59
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

review.await-update Awaiting Updates after Edits

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants