bevy/crates/bevy_pbr/src/render
Patrick Walton 1141e731ff
Implement alpha to coverage (A2C) support. (#12970)
[Alpha to coverage] (A2C) replaces alpha blending with a
hardware-specific multisample coverage mask when multisample
antialiasing is in use. It's a simple form of [order-independent
transparency] that relies on MSAA. ["Anti-aliased Alpha Test: The
Esoteric Alpha To Coverage"] is a good summary of the motivation for and
best practices relating to A2C.

This commit implements alpha to coverage support as a new variant for
`AlphaMode`. You can supply `AlphaMode::AlphaToCoverage` as the
`alpha_mode` field in `StandardMaterial` to use it. When in use, the
standard material shader automatically applies the texture filtering
method from ["Anti-aliased Alpha Test: The Esoteric Alpha To Coverage"].
Objects with alpha-to-coverage materials are binned in the opaque pass,
as they're fully order-independent.

The `transparency_3d` example has been updated to feature an object with
alpha to coverage. Happily, the example was already using MSAA.

This is part of #2223, as far as I can tell.

[Alpha to coverage]: https://en.wikipedia.org/wiki/Alpha_to_coverage

[order-independent transparency]:
https://en.wikipedia.org/wiki/Order-independent_transparency

["Anti-aliased Alpha Test: The Esoteric Alpha To Coverage"]:
https://bgolus.medium.com/anti-aliased-alpha-test-the-esoteric-alpha-to-coverage-8b177335ae4f

---

## Changelog

### Added

* The `AlphaMode` enum now supports `AlphaToCoverage`, to provide
limited order-independent transparency when multisample antialiasing is
in use.
2024-04-15 20:37:52 +00:00
..
clustered_forward.wgsl Add random shader utils, fix cluster_debug_visualization (#11956) 2024-02-26 15:59:44 +00:00
fog.rs Refactor App and SubApp internals for better separation (#9202) 2024-03-31 03:16:10 +00:00
fog.wgsl update shader imports (#10180) 2023-10-21 11:51:58 +00:00
forward_io.wgsl Implement lightmaps. (#10231) 2024-01-02 20:38:47 +00:00
gpu_preprocess.rs Generate MeshUniforms on the GPU via compute shader where available. (#12773) 2024-04-10 05:33:32 +00:00
light.rs Implement alpha to coverage (A2C) support. (#12970) 2024-04-15 20:37:52 +00:00
mesh_bindings.rs Implement lightmaps. (#10231) 2024-01-02 20:38:47 +00:00
mesh_bindings.wgsl Swap material and mesh bind groups (#10485) 2023-11-28 22:26:22 +00:00
mesh_functions.wgsl Add support for KHR_texture_transform (#11904) 2024-02-21 01:11:28 +00:00
mesh_preprocess.wgsl Generate MeshUniforms on the GPU via compute shader where available. (#12773) 2024-04-10 05:33:32 +00:00
mesh_types.wgsl Add support for KHR_texture_transform (#11904) 2024-02-21 01:11:28 +00:00
mesh_view_bindings.rs Consolidate Render(Ui)Materials(2d) into RenderAssets (#12827) 2024-04-09 13:26:34 +00:00
mesh_view_bindings.wgsl FIX: iOS Simulator not rendering due to missing CUBE_ARRAY_TEXTURES (#12052) 2024-02-23 01:24:59 +00:00
mesh_view_types.wgsl Implement irradiance volumes. (#10268) 2024-02-06 23:23:20 +00:00
mesh.rs Implement alpha to coverage (A2C) support. (#12970) 2024-04-15 20:37:52 +00:00
mesh.wgsl Update to wgpu 0.19 and raw-window-handle 0.6 (#11280) 2024-01-26 18:14:21 +00:00
mod.rs Generate MeshUniforms on the GPU via compute shader where available. (#12773) 2024-04-10 05:33:32 +00:00
morph.rs Relax BufferVec's type constraints (#12866) 2024-04-05 02:11:41 +00:00
morph.wgsl Swap material and mesh bind groups (#10485) 2023-11-28 22:26:22 +00:00
parallax_mapping.wgsl update shader imports (#10180) 2023-10-21 11:51:58 +00:00
pbr_ambient.wgsl Use “specular occlusion” term to consistently extinguish fresnel on Ambient and Environment Map lights (#10182) 2023-10-23 03:26:20 +00:00
pbr_bindings.wgsl Swap material and mesh bind groups (#10485) 2023-11-28 22:26:22 +00:00
pbr_fragment.wgsl Implement alpha to coverage (A2C) support. (#12970) 2024-04-15 20:37:52 +00:00
pbr_functions.wgsl Implement alpha to coverage (A2C) support. (#12970) 2024-04-15 20:37:52 +00:00
pbr_lighting.wgsl update shader imports (#10180) 2023-10-21 11:51:58 +00:00
pbr_prepass_functions.wgsl Implement alpha to coverage (A2C) support. (#12970) 2024-04-15 20:37:52 +00:00
pbr_prepass.wgsl Meshlet rendering (initial feature) (#10164) 2024-03-25 19:08:27 +00:00
pbr_transmission.wgsl Exposure settings (adopted) (#11347) 2024-01-16 14:53:21 +00:00
pbr_types.wgsl Implement alpha to coverage (A2C) support. (#12970) 2024-04-15 20:37:52 +00:00
pbr.wgsl Meshlet rendering (initial feature) (#10164) 2024-03-25 19:08:27 +00:00
rgb9e5.wgsl Deferred Renderer (#9258) 2023-10-12 22:10:38 +00:00
shadow_sampling.wgsl Implement percentage-closer filtering (PCF) for point lights. (#12910) 2024-04-10 20:16:08 +00:00
shadows.wgsl Implement percentage-closer filtering (PCF) for point lights. (#12910) 2024-04-10 20:16:08 +00:00
skin.rs try_insert NoAutomaticBatching (#12396) 2024-03-10 02:14:33 +00:00
skinning.wgsl Swap material and mesh bind groups (#10485) 2023-11-28 22:26:22 +00:00
utils.wgsl Add random shader utils, fix cluster_debug_visualization (#11956) 2024-02-26 15:59:44 +00:00
view_transformations.wgsl View Transformations (#9726) 2023-10-24 21:26:19 +00:00
wireframe.wgsl Swap material and mesh bind groups (#10485) 2023-11-28 22:26:22 +00:00