Front-to-Back Alpha Compositing

Allocate color contributions by remaining transmittance and calculate how two partially opaque layers share one pixel.

Source
Anbloq
Language
English
Created
Updated
Chapters
2
Reading time
1 min
In this article2 chapters
  1. An early layer limits what can be seen behind it
  2. Track color and total opacity in a consistent representation

An early layer limits what can be seen behind it

A front layer with opacity \(\alpha_1\) supplies color weight \(\alpha_1\). A rear layer with opacity \(\alpha_2\) supplies weight \((1-\alpha_1)\alpha_2\), because only the unblocked fraction reaches it. With opacities \(0.3\) and \(0.5\), weights are \(0.3\) and \(0.35\). The background receives \(0.35\). Swapping the layers generally changes pixel color because those weights are assigned to different colors.

Track color and total opacity in a consistent representation

Premultiplied color stores the opacity-weighted contribution and lets a compositor combine it with remaining transmittance. Mixing premultiplied and unassociated channels changes results where opacity is low. Color space also matters when interpolating light intensity. Depth testing handles opaque selection. Neural 3D reconstruction uses related accumulation for opacity along many ray samples.[1]

References

  1. Matt Pharr, Wenzel Jakob and Greg Humphreys, Physically Based Rendering ↩