How do I blend two colors using SrcAlpha and OneMinusSrcAlpha when I have HDR range (rgb and a values can be > 1)?

The typical formula for non-HDR is (src * srcAlpha) + (dst * (1.0 - srcAlpha)) but this generates a negative value if srcAlpha is > 1.

  • 1
    \$\begingroup\$ How did alpha end up greater than 1? Only the RGB channels should exceed the 0-1 range in HDR, not the 'opaqueness' or 'transparency' of a scene. \$\endgroup\$ – Chuck Walbourn Sep 20 '17 at 20:29

Clamp your srcAlpha between 0 and 1.

Your pixels can't be more opaque than 100% or more transparent than 0% opacity.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.