Skip to content

Conversation

@beicause
Copy link
Contributor

@beicause beicause commented Nov 8, 2025

Objective

Implements WBOIT https://learnopengl.com/Guest-Articles/2020/OIT/Weighted-Blended as an alternative to exact OIT. Compared to current exact oit, it uses constant memory that is independent of layers and does not require sorting in the shader, potentially offering better performance. The major limitation is that WBOIT is inaccurate when alpha is close to opacity.

Also adds unsorted transparent which skips cpu sorting for performance.

Solution

  • Current OrderIndependentTransparency is renamed to ExactOit
  • Adds a dedicated render phase for WBOIT. To enable WBOIT you need to add WeightedBlendedOit component to the camera and set material alpha mode to AlphaMode::WeightedBlend.
  • Adds unsorted transparent phase item which is used for AlphaMode::UnsortedBlend/Add/Multiply.

Testing

Added WBOIT to the order_independent_transparency example.

Showcase

ExactOit WbOit
屏幕截图_20251108_133257 屏幕截图_20251108_133306
屏幕截图_20251108_133221 屏幕截图_20251108_133238

@alice-i-cecile alice-i-cecile added C-Feature A new feature, making something new possible A-Rendering Drawing game state to the screen M-Release-Note Work that should be called out in the blog due to impact S-Needs-Review Needs reviewer attention (from anyone!) to move forward labels Nov 8, 2025
@github-actions
Copy link
Contributor

github-actions bot commented Nov 8, 2025

It looks like your PR has been selected for a highlight in the next release blog post, but you didn't provide a release note.

Please review the instructions for writing release notes, then expand or revise the content in the release notes directory to showcase your changes.

@IceSentry
Copy link
Contributor

I haven't looked at the PR yet but just a small note, the current OIT impl also has constant memory use. It uses a fixed buffer size that is configurable. The issue in terms of memory is that it uses a lot of memory but the amount it uses is fixed with the resolution of the camera.

Also, I'd like to have actual performance comparison before merging something like this because it adds a lot of complexity that might be hard to justify if the performance characteristics are similar.

@IceSentry
Copy link
Contributor

Also, in terms of OIT that isn't accurate there are more modern techniques that should probably be used instead of WBOIT. Moment based OIT is one of them.

There's also the approach in this post that seems interesting and more accurate than WBOIT https://osor.io/OIT

@beicause beicause marked this pull request as draft November 8, 2025 12:01
@beicause
Copy link
Contributor Author

beicause commented Nov 8, 2025

I think you're right. WBOIT doesn't model the transmittance function at all and can lead to poor results in some cases. I'll look into MBOIT and Wavelet OIT and redo this PR.

@IceSentry
Copy link
Contributor

There's still some things in this PR that I think could be extracted to a separate smaller PR. I think having the UnorderedTransparent3d phase makes sense as a standalone PR. Although, enabling it for OIT should probably be configurable. I tried something like it in the past when working on the pixel list OIT and I didn't have great results from it. If we are going to have multiple OIT solutions it would make sense to have it as an option though.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-Rendering Drawing game state to the screen C-Feature A new feature, making something new possible M-Release-Note Work that should be called out in the blog due to impact S-Needs-Review Needs reviewer attention (from anyone!) to move forward

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

3 participants