webxr-ar-module
webxr-ar-module copied to clipboard
More explicit alpha-blending functions
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.
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.
- 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
- 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.