mirror of
https://github.com/bevyengine/bevy
synced 2024-12-29 22:43:14 +00:00
4bf647ff3b
# Objective - Alpha blending can easily fail in many situations and requires sorting on the cpu ## Solution - Implement order independent transparency (OIT) as an alternative to alpha blending - The implementation uses 2 passes - The first pass records all the fragments colors and position to a buffer that is the size of N layers * the render target resolution. - The second pass sorts the fragments, blends them and draws them to the screen. It also currently does manual depth testing because early-z fails in too many cases in the first pass. ## Testing - We've been using this implementation at foresight in production for many months now and we haven't had any issues related to OIT. --- ## Showcase ![image](https://github.com/user-attachments/assets/157f3e32-adaf-4782-b25b-c10313b9bc43) ![image](https://github.com/user-attachments/assets/bef23258-0c22-4b67-a0b8-48a9f571c44f) ## Future work - Add an example showing how to use OIT for a custom material - Next step would be to implement a per-pixel linked list to reduce memory use - I'd also like to investigate using a BinnedRenderPhase instead of a SortedRenderPhase. If it works, it would make the transparent pass significantly faster. --------- Co-authored-by: Kristoffer Søholm <k.soeholm@gmail.com> Co-authored-by: JMS55 <47158642+JMS55@users.noreply.github.com> Co-authored-by: Charlotte McElwain <charlotte.c.mcelwain@gmail.com> |
||
---|---|---|
.. | ||
clustered_forward.wgsl | ||
fog.rs | ||
fog.wgsl | ||
forward_io.wgsl | ||
gpu_preprocess.rs | ||
light.rs | ||
mesh.rs | ||
mesh.wgsl | ||
mesh_bindings.rs | ||
mesh_bindings.wgsl | ||
mesh_functions.wgsl | ||
mesh_preprocess.wgsl | ||
mesh_types.wgsl | ||
mesh_view_bindings.rs | ||
mesh_view_bindings.wgsl | ||
mesh_view_types.wgsl | ||
mod.rs | ||
morph.rs | ||
morph.wgsl | ||
parallax_mapping.wgsl | ||
pbr.wgsl | ||
pbr_ambient.wgsl | ||
pbr_bindings.wgsl | ||
pbr_fragment.wgsl | ||
pbr_functions.wgsl | ||
pbr_lighting.wgsl | ||
pbr_prepass.wgsl | ||
pbr_prepass_functions.wgsl | ||
pbr_transmission.wgsl | ||
pbr_types.wgsl | ||
rgb9e5.wgsl | ||
shadow_sampling.wgsl | ||
shadows.wgsl | ||
skin.rs | ||
skinning.wgsl | ||
utils.wgsl | ||
view_transformations.wgsl | ||
wireframe.wgsl |