Implement Premultiplied Alpha for OIT (#22821)
# Objective - Allow rendering objects with `AlphaMode::Premultiplied` and `AlphaMode::Add` while using Order Independent Transparency. - Fixes #20373. ## Solution - Store Premultiplied color in the OIT buffer and premultiply in the case of `AlphaMode::Blend`, this shouldn't have any downsides since blending was done with premultiplied alpha anyway. - It might be useful to actively break the `oit_draw` signature by adding a `premultiply` bool to ensure that shader authors are aware of the changed meaning of the `color` argument. ## Testing - These changes have been tested by running the modified `order_independent_transparency` example, an older version of these changes has been in use in a project i work on. --- ## Showcase Here the Red Sphere uses `AlphaMode::Blend`, the Blue Sphere `AlphaMode::Add` and the Green Sphere `AlphaMode::Premultiplied`. <img width="1270" height="708" alt="bevy-oit-example" src="https://github.com/user-attachments/assets/282d7083-458f-4ecd-b098-20b3539de796" /> --------- Signed-off-by: Schmarni <marnistromer@gmail.com> Co-authored-by: Carter Anderson <mcanders1@gmail.com>
S
Schmarni committed
2c3bdfdd25745b115ac776f925f666bfa89d29f3
Parent: b6f35de
Committed by GitHub <noreply@github.com>
on 5/21/2026, 2:01:32 PM