Adds documentation for antialiasing with impeller#13370
Adds documentation for antialiasing with impeller#13370gaaclarke wants to merge 5 commits intoflutter:mainfrom
Conversation
|
Visit the preview URL for this PR (updated for commit 76cc499): https://flutter-docs-prod--pr13370-antialias-doc-17a96hc6.web.app |
andywolff
left a comment
There was a problem hiding this comment.
LGTM. Contents and location of the new doc make sense to me.
sfshaza2
left a comment
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
| 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 |
There was a problem hiding this comment.
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.
| Typically, hardware accelerated computer graphics is done by defining a series | ||
| of points and edges (a [mesh][]) and [shaders][]. SDF rendering instead renders |
There was a problem hiding this comment.
| 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 |
There was a problem hiding this comment.
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.
| 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 |
There was a problem hiding this comment.
| 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 |
| shader there is an opportunity to smooth out edges at the fragment level instead | ||
| of relying on the rasterization of a mesh. |
There was a problem hiding this comment.
| 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. |
| On desktop, rendering with SDFs is enabled. On mobile platforms SDFs is an | ||
| option whose default value is false. |
There was a problem hiding this comment.
| 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. |
|
|
||
| ### SDFs with the FragmentShader API | ||
|
|
||
| Standard primitive shapes in Flutter will be drawn automatically with SDFs. If |
There was a problem hiding this comment.
| Standard primitive shapes in Flutter will be drawn automatically with SDFs. If | |
| Standard primitive shapes in Flutter are drawn automatically with SDFs. If |
| 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. |
There was a problem hiding this comment.
Do we want to say more about this? Why might it be ignored even if disabled?
There was a problem hiding this comment.
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 |
There was a problem hiding this comment.
| pixels (rasterization). Impeller employs a couple of techniques to smooth out | |
| pixels (rasterization). Impeller employs a couple techniques to smooth out |
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
of 80 characters or fewer.