Skip to content

Commit

Permalink
refine multisampling article
Browse files Browse the repository at this point in the history
  • Loading branch information
greggman committed Jan 6, 2024
1 parent 2bff9d8 commit 931a298
Show file tree
Hide file tree
Showing 2 changed files with 43 additions and 33 deletions.
69 changes: 39 additions & 30 deletions webgpu/lessons/resources/antialias-multisample-4.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
7 changes: 4 additions & 3 deletions webgpu/lessons/webgpu-multisampling.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ we get this
</div>

Above, with 4x rendering and the triangle covering 3 pixels' centers, the fragment shader is called 3 times.
We then bilinear filter the result.
Later we then bilinear filter the result.

This is where multisampling is more efficient. We create a special "multisample texture".
When we draw a triangle to a multisample texture, If any of the 4 *samples*
Expand All @@ -79,8 +79,9 @@ We then *resolve* the result. The process would be similar if the triangle cover
shader would only be called once but its result would be written to all 4 samples.

Notice that, unlike the 4x rendering where the CPU checked if the centers of the 4 pixels were inside the triangle,
with multisampled rendering the GPU checks "sample positions" which are not in the center. These un-centered
sample positions apparently result in better anti-aliasing for most situations.
with multisampled rendering the GPU checks "sample positions" which are not in a grid. Similarly, the sample
values themselves do not represent a grid so the process of "resolving" them is not bilinear filtering but rather
up to the GPU. These un-centered sample positions apparently result in better anti-aliasing for most situations.

## <a id="a-multisampling"></a> How to use multisampling.

Expand Down

0 comments on commit 931a298

Please sign in to comment.