Skip to content

Add WEIGHTED_BLEND order-independent transparency mode - #701

Open
xy-lin wants to merge 1 commit into
coin3d:masterfrom
xy-lin:feature/weighted-blend-oit
Open

xy-lin wants to merge 1 commit into
coin3d:masterfrom
xy-lin:feature/weighted-blend-oit

Conversation

@xy-lin

@xy-lin xy-lin commented Sep 6, 2026

Copy link
Copy Markdown

Closes #647

Summary

This adds WEIGHTED_BLEND to SoGLRenderAction::TransparencyType, implementing weighted-blended order-independent transparency (WBOIT) from McGuire and Bavoil's 2013 paper.

WBOIT accumulates transparent fragments with order-independent blending operations, so object and triangle sorting are not required. It is approximate, but handles intersecting transparent geometry more consistently than sorted alpha blending. The new mode is opt-in; existing transparency types are untouched.

Reference: Morgan McGuire and Louis Bavoil, "Weighted Blended Order-Independent Transparency," JCGT 2(2), 2013: https://jcgt.org/published/0002/02/09/

Implementation

  1. Renders opaque geometry normally.
  2. Accumulates transparent geometry into floating-point color and revealage attachments.
  3. Composites the accumulated result over the opaque image.

It reuses Coin's existing transparent-object collection and replay machinery, and the new enum value is appended so existing values are unchanged. OpenGL resources are allocated lazily and released through Coin's context-lifetime mechanisms; the currently bound framebuffer is preserved, so the mode works with compatible nonzero framebuffer objects.

Requirements and limitations

  • Requires framebuffer objects, multiple render targets, floating-point color attachments, per-target blending, GLSL, and an OpenGL compatibility profile.
  • Binding a program replaces fixed-function fragment processing, so this path reproduces fixed-function color and modulated 2D texturing only. Some multitexture configurations are not yet reproduced exactly.
  • Scene-supplied shader programs are not supported by this path.
  • Multisampled framebuffers and incompatible depth attachments use Coin's conventional transparent rendering path.
  • WBOIT is an approximation and does not reproduce exact depth peeling.

Validation

Built Debug and Release on Windows 11 with IntelLLVM 2024.2, Visual Studio 2019 tools, and Ninja. The Coin Debug unit suite passed: 326 tests, 83,566 checks. The mode was also exercised in an application build; comparison images are in #647.

@veelo

veelo commented Sep 19, 2026

Copy link
Copy Markdown
Member

@tritao would it interfere with your work if we merged this?

I asked Grok to have a look and the only thing it complained about is always registering a context-destruction callback, also when this mode is not used.

@tritao

tritao commented Sep 20, 2026

Copy link
Copy Markdown
Contributor

@tritao would it interfere with your work if we merged this?

I asked Grok to have a look and the only thing it complained about is always registering a context-destruction callback, also when this mode is not used.

My work does not touch the legacy OpenGL, it's strictly additive, so no conflict there, feel free to merge.

@veelo

veelo commented Sep 20, 2026

Copy link
Copy Markdown
Member

@xy-lin could you please resolve conflicts? Thanks!

@veelo
veelo self-requested a review September 20, 2026 14:20

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add weighted-blended order-independent transparency mode

3 participants