Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

More explicit alpha-blending functions #43

Open
kearwood opened this issue Sep 17, 2018 · 3 comments
Open

More explicit alpha-blending functions #43

kearwood opened this issue Sep 17, 2018 · 3 comments
Milestone

Comments

@kearwood
Copy link
Contributor

When alpha blending is used, such as XREnvironmentBlendMode's "alpha-blend" option, we could be more explicit about how the blending is performed. Additionally, perhaps we could provide a more granular selection of blending modes.

In particular:

  • We should explicitly state if the blending is done in gamma color space or linear color space.
  • A more performant and flexible method of alpha blending would be "pre multiplied alpha". With pre-multiplied alpha, both additive and alpha blended pixels can be expressed in a single buffer and composited in a more performant manner in many cases.
@toji
Copy link
Member

toji commented Oct 16, 2019

Given that XREnvironmentBlendMode and all descriptions of it have been moved to the AR module, I'm transferring this issue over as well. It may possibly already be addressed, in fact, but we'll have to take a closer look to determine that.

@toji toji transferred this issue from immersive-web/webxr Oct 16, 2019
@rcabanier
Copy link
Contributor

  • We should explicitly state if the blending is done in gamma color space or linear color space.

Compositing on the web platform always happens in the native colorspace of the page. For almost all pages, that sRGB.

  • A more performant and flexible method of alpha blending would be "pre multiplied alpha". With pre-multiplied alpha, both additive and alpha blended pixels can be expressed in a single buffer and composited in a more performant manner in many cases.

It's up to the UA to decide if they want to do compositing in premultiplied data. The compositing formulas for either mode should result in the same end result

@klausw
Copy link
Contributor

klausw commented Oct 17, 2019

  • A more performant and flexible method of alpha blending would be "pre multiplied alpha". With pre-multiplied alpha, both additive and alpha blended pixels can be expressed in a single buffer and composited in a more performant manner in many cases.

It's up to the UA to decide if they want to do compositing in premultiplied data. The compositing formulas for either mode should result in the same end result

The UA can do its internal compositing in whatever way it wants, but the spec is now unambiguous that the alpha channel of the WebXR opaque framebuffer must be treated as premultiplied. That's an external interface, and it's important to get consistent behavior across implementations here.

https://immersive-web.github.io/webxr/#xrwebgllayer-interface

The XR Compositor will assume the opaque framebuffer contains colors with premultiplied alpha. This is true regardless of the premultipliedAlpha value set in the context's actual context parameters.

@NellWaliczek NellWaliczek added this to the Future milestone Oct 21, 2019
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

No branches or pull requests

5 participants