ADOBE AFTER EFFECTS: Forum Expressions Tutorials Creative Cloud

Linear space and alpha channel output

COW Forums : Adobe After Effects

<< PREVIOUS   •   FAQ   •   VIEW ALL   •   PRINT   •   NEXT >>
Andrew SomersLinear space and alpha channel output
by on Apr 29, 2015 at 1:33:15 pm

I am wondering if there is a plug-in to handle this:

When working in a linearized color space but outputting to a gamma encoded space such as Rec709, the ALPHA channel is not output correctly - the alpha that is output Is based on opacity for linear (gamma 1.0) blending - however, when we are outputting a gamma encoded file, such as say a tiff with alpha, it is typically going to be used in a system where compositing operations are performed in a gamma encoded space.

As such, the alpha should reflect the different opacities needed for correct compositing in the gamma encoded space of the output file, and NOT the opacities used in the linear (gamma 1.0) space.

Ideally, there should be a switch/checkbox in the color management tab of the output module that addresses this, such as: "Alter alpha opacities to match perceptual intent of output gamma".

At the moment, it seems the best/only way to handle this is to work in the same gamma encoded space as the final output.

Any other thoughts?


Return to posts index

Dave LaRondeRe: Linear space and alpha channel output
by on Apr 29, 2015 at 4:12:58 pm

You could always opt to render a separate alpha only file, creating a B&W file which can be used as a luma matte by the next application.

Dave LaRonde
Promotion Producer
KGAN (CBS) & KFXA (Fox) Cedar Rapids, IA


Return to posts index

Andrew SomersRe: Linear space and alpha channel output
by on Apr 29, 2015 at 4:44:39 pm

That doesn't solve the problem, as delivery specs are RGBA. If it was only our internal workflow it wouldn't be a problem, but the image sequence and/or QuickTime must be handed off to another facility, and we have to meet their delivery specs.

Our normal internal workflow is a linear (gamma 1.0) colorspace, but due to this issues we must use a gamma encoded colorspace when we need to associate an alpha channel.

The problem remains: linear colorspaces use a different opacity than gamma encoded spaces for the same perceptual intent, and AE does not compensate.


Return to posts index



Walter SoykaRe: Linear space and alpha channel output
by on Apr 30, 2015 at 1:03:03 pm

[Andrew Somers] "The problem remains: linear colorspaces use a different opacity than gamma encoded spaces for the same perceptual intent, and AE does not compensate."

I know this doesn't help you now, but I think this should be filed as a bug [link].

Walter Soyka
Designer & Mad Scientist at Keen Live [link]
Motion Graphics, Widescreen Events, Presentation Design, and Consulting
@keenlive [twitter]   |   RenderBreak [blog]   |   Profile [LinkedIn]


Return to posts index

Darby EdelenRe: Linear space and alpha channel output
by on Apr 30, 2015 at 9:07:10 pm
Last Edited By Darby Edelen on Apr 30, 2015 at 9:21:54 pm

[Andrew Somers] "it is typically going to be used in a system where compositing operations are performed in a gamma encoded space."

Well that seems like the problem right there.

The results of blending in a gamma encoded space won't be the same as the results in a linear space if you just tried to mess with the alpha values. Remember, alpha is just a numerical weighting of the blend operation, but the difference between linear and gamma encoded space is not in the blend operation, rather it's in the input to the blend operation (the colors that are being blended) and the output (the interpretation of the resulting color).

No amount of fussing with the alpha could give you the same blend results in a gamma encoded space as a linear space.

Darby Edelen


Return to posts index

Darby EdelenRe: Linear space and alpha channel output
by on Apr 30, 2015 at 9:20:52 pm

Realizing that the previous post wasn't very encouraging I'll add that if you want the blend to look the same you actually need to adjust the RGB values not the alpha.

Both blend layers would need to be re-interpreted from the gamma encoded space to a linear space, then the blend would occur and then you'd translate the resulting colors from the linear space to gamma encoded. Of course this is what a linear composting workflow does behind the scenes so instead of that whole rigmarole I'd either work the way you've decided to (in gamma) or bug the people downstream to work they way they should (in linear).

Darby Edelen


Return to posts index


Andrew SomersRe: Linear space and alpha channel output
by on May 1, 2015 at 11:20:05 am

At Darby: After Effects' output module does a good job of converting the image data from linear space to a gamma encoded space. What After Effects fails to do is convert the opacity data from linear to gamma encoded.

The numerical value of the alpha channel relative to a linear ColorSpace results in a substantially different perceptual blend them the same numerical value in a gamma encoded space.

For instance 10% opacity in linear space will appear denser than 10% in a gamma encoded space, even though the input image data is the same.


Return to posts index

Darby EdelenRe: Linear space and alpha channel output
by on May 1, 2015 at 6:05:32 pm
Last Edited By Darby Edelen on May 1, 2015 at 6:07:00 pm

[Andrew Somers] "even though the input image data is the same."

The input image data (the numerical values of the colors in the layer) is generally only the same between linear and gamma spaces inside of After Effects if you're using a native AE layer (text layer, solid layer, shape layer) as your assets. Otherwise the image data of imported assets is modified to attempt to maintain perceptual uniformity.

Similarly, when AE exports your image using color management from linear to gamma encoded the numerical color values change which is what causes the blends to look different. The alpha should not be color managed as it's just a weighting for blend operations.

A 10% opaque white layer will appear "more dense" above a solid 100% red layer in linear but a 10% opaque black layer will appear "less dense" in linear.

The White Blend:
(1.0, 1.0, 1.0)(RGB) * 0.1(Alpha weighting) + (1.0, 0.0, 0.0)(RGB) * (1 - 0.1)(Alpha weighting) = (0.1,0.1,0.1) + (0.9,0.0,0.0) = (1,0.1,0.1)

So the resulting color is (1, 0.1, 0.1) in both gamma and linear space. However, this color is much whiter in linear space than a gamma encoded space (0.1 is almost middle gray in linear, it's almost black in gamma encoded). The white blend will look more dense in a linear space because the working color space values are not perceptually weighted.

The Black Blend:
(0.0, 0.0, 0.0) * 0.1 + (1.0, 0.0, 0.0) * (1 - 0.1) = (0.0, 0.0, 0.0) + (0.9, 0.0, 0.0)

So the resulting color is (0.9, 0.0, 0.0) in both gamma and linear space. However, this color is darker in gamma space because 0.9 is darker than in linear (you can look at the linear vs. gamma encoded color picker to see this). The black blend will appear more dense in a gamma encoded space because the working color space values are perceptually weighted toward the dark end.

That should be a good indication that it is not the alpha values that affect the difference in blending.

Darby Edelen


Return to posts index

Andrew SomersRe: Linear space and alpha channel output
by on May 2, 2015 at 2:45:32 am

Darby, we are talking about two different things.

If you take white text, and set opacity to 10%, the perceived transparency in linear is denser than it is in a gamma encoded space. But that is not what I am talking about.

If you are working in linear space, and use an output module to output to a tiff using a gamma encoded space such as rec709 or sRGB, and your alpha is straight, the image will be perceptually the same when viewed in the gamma encoded space as it was while working in linear space.

However, the alpha will not work on systems that use the gamma encoded space to blend.

However if you import that image into a linear space environment, the alpha values will be correct.

If you convert to a gamma encoded space, the alpha values must be changed to accomplish the same perceptual intent. This means that when after effects outputs from a linear working space to a gamma encoded space, it is not converting the alpha values to create the same perceptual intent. It should be clear that this makes the gamma encoded RGBA output unuseable.

The workaround is to NOT use linear space when the output needs to have an alpha and be in a gamma encoded space.

The color values of the text are correct when opacity is 100%. And when alpha is straight, these RGB values do NOT change. But the opacity as interpreted by a compositing system that is blending in gamma encoded space does not match that of the perceptual intent when working in linear space.

I've been playing with modifying the alpha channel values - but ideally there would be an option in the output module to adjust the alpha for the same perceptual intent. It is the alpha. The alpha needs to be modified ALONG WITH the RGB data when outputting from linear to a gamma encoded space.


Return to posts index


Darby EdelenRe: Linear space and alpha channel output
by on May 2, 2015 at 7:38:00 pm
Last Edited By Darby Edelen on May 2, 2015 at 8:23:50 pm

As should've been apparent in my previous reply the "density" of the blend depends on a combination of how colors are interpreted and what the alpha values are. There is simply no way to get the same perceptual result as a blend in linear space in gamma space by modifying the alpha because the colors are interpreted differently.

If you still don't believe it I can put more comprehensive examples together (with pictures!) when I have some free time at my computer.

Darby Edelen


Return to posts index

Darby EdelenRe: Linear space and alpha channel output
by on May 4, 2015 at 9:11:53 pm

Here's a test image with a 100% Red solid blended with a 100% Green solid, the blend is a linear ramp.

Here's the resulting blend in a linear working space:



Here's the resulting blend in a gamma encoded working space:



There is no way to modify the alpha of the Red solid in a gamma encoded space to produce the same result as the blend in linear space.

In this case the way to get the gamma encoded blend to look like the linear blend is to transform the resulting colors from linear values to gamma encoded values. The closest you can get in Photoshop is to apply a gamma of 2.2 or so to the gamma encoded result (I was using sRGB in these examples).

This is a simple example because none of the straight RGB colors involved are affected by gamma. However, if you're using RGB values that aren't 1 or 0 in every channel then there's an extra step: you have to linearize the colors before blending by applying the inverse gamma to each blend layer.

Here's the red gradient I was using in these examples. I'd encourage you to try adjusting the alpha to compensate for the difference and then the RGB values:

8810_redgradient.tif.zip

To re-iterate: it is not the alpha that makes these blends look different, it is the interpretation of the RGB values.

Darby Edelen


Return to posts index

Andrew SomersRe: Linear space and alpha channel output
by on May 5, 2015 at 2:34:36 am

Darby, we are still not discussing the same thing.

I am not talking about blends of colors in linear space.

I am talking about TRANSPARENCY.

White titles coming out using the output module's conversion to a gamma encoded space do not have the same perceptual transparency because the output module's alpha channel is wrong.

It is trivial to convert the RGB image data from a linear space to a gamma encoded space. What is needed is to also convert the alpha channel to provide the same relative transparency in the target application.


Return to posts index


Darby EdelenRe: Linear space and alpha channel output
by on May 5, 2015 at 4:34:22 am
Last Edited By Darby Edelen on May 5, 2015 at 5:56:16 pm

I'm sorry, I think you're missing the forest for the trees.

The only reason to have transparency is to blend the image over another image.

What I'm telling you is that the blending operation itself is color space and gamma independent. Only the colors involved in the blend are dependent on the color space and gamma. Alpha values should never change between color spaces, the alpha is not a color, it is a weighting for the blend operation. Which, as I've already said, does not depend on color space or gamma.

I think you need to provide a concrete example of why you want the alpha to change its values when rendering from linear to gamma encoded. Are you trying to preserve the look of a linear blend? If so then modifying the alpha will never get you there*. If not, then there's no reason to work in linear to begin with.

*Except in the special case of blending pure colors (100% or 0% intensity in all channels) with white or black.

Darby Edelen


Return to posts index

Andrew SomersRe: Linear space and alpha channel output
by on May 7, 2015 at 3:25:03 am

I've already provided concrete examples, as I stated: text, fades, and transparent drop shadow. But I don't seem to be getting the point across to you, as you are bringing up separate (and not directly related) issues.

At some point when I have time I will provide the workflow reasons with examples. Until then I'll table the discussion as we aren't getting anywhere.


Return to posts index

Darby EdelenRe: Linear space and alpha channel output
by on May 7, 2015 at 5:01:56 pm

This is frustrating as I'm sure we could arrive at a mutually agreed conclusion in a matter of minutes if we were talking face to face in front of AE.

[Andrew Somers] "But I don't seem to be getting the point across to you, as you are bringing up separate (and not directly related) issues."

This is an interesting observation. If your perceived issue is transparency then I don't see how the alpha blending operation could be separate from the discussion. Any transparent image is always being blended. It may be blended with the default checkerboard pattern or another default colored background, but the blend and the transparency are inextricably linked and I would argue that they cannot be considered separately. They're two sides of the same coin.

Darby Edelen


Return to posts index


Darby EdelenRe: Linear space and alpha channel output
by on Jul 3, 2015 at 8:52:14 pm

Andrew, if you ever found time to collect some workflow examples I'd love to take a look at them.

Darby Edelen


Return to posts index

Darby EdelenRe: Linear space and alpha channel output
by on Aug 26, 2015 at 9:43:55 am

[Andrew Somers] "At some point when I have time I will provide the workflow reasons with examples. Until then I'll table the discussion as we aren't getting anywhere."

Have you found any time to share some examples?

Darby Edelen


Return to posts index

Darby EdelenRe: Linear space and alpha channel output
by on Dec 20, 2015 at 5:30:34 am

[Andrew Somers] "At some point when I have time I will provide the workflow reasons with examples. "

I realize it's been several months, but I'm still very much interested in seeing your examples.

Darby Edelen


Return to posts index

<< PREVIOUS   •   VIEW ALL   •   PRINT   •   NEXT >>
© 2017 CreativeCOW.net All Rights Reserved
[TOP]