Lorem ipsum dolor sit amet, consectetur adipiscing elit. Vivamus ac diam turpis. Sed iaculis, ligula tempus porttitor vestibulum, dolor ipsum luctus lorem, a ultrices orci elit sit amet augue. Donec fringilla eros libero, non venenatis ante. Donec molestie diam quis nunc imperdiet congue. Fusce interdum accumsan ullamcorper. In adipiscing metus sit amet mauris accumsan vitae dictum metus convallis. Suspendisse aliquet consequat arcu eu pharetra. Praesent cursus ullamcorper libero, at porttitor sem imperdiet ac. Aliquam erat volutpat. Donec venenatis dui tristique ipsum dignissim adipiscing. Pellentesque tincidunt ornare mi eget euismod. Curabitur consectetur convallis ipsum, sit amet sodales ipsum laoreet eget. Aliquam ac congue dui.

Donec eu blandit dui. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Morbi quis accumsan dolor. Duis sagittis consequat ligula vel adipiscing. Quisque non elementum diam. Mauris dignissim, mauris a adipiscing mollis, augue lacus elementum tellus, a blandit arcu velit ut risus. Morbi nisi erat, rhoncus nec laoreet ut, sagittis eget sem. Praesent placerat, diam at tristique faucibus, mi nisi tincidunt ipsum, eu lacinia eros sem quis nisl. Phasellus quam metus, mollis vitae elementum eu, ultrices eu mauris. Donec non sapien et tortor facilisis ornare a at diam.

(F1+F2)/2

Duis ullamcorper dignissim massa, sed gravida elit molestie eu. Cras vulputate, nunc eu accumsan euismod, odio tortor rutrum leo, nec egestas urna dui id nisl. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Integer sagittis, purus dictum porta gravida, lacus ante condimentum ante, id convallis leo mauris quis erat. Nullam vitae lacus erat, dapibus ultricies felis. Morbi lacinia dictum commodo. Mauris pretium, libero ut faucibus iaculis, est dui rutrum magna, ac pulvinar sem dui et sapien. Aliquam viverra nunc at sem tincidunt sit amet commodo nisl gravida. Nullam in eros vitae dui laoreet tincidunt non ut risus. Praesent suscipit rutrum nisl, sit amet varius sem gravida interdum.

Nulla facilisi. Fusce commodo malesuada risus eu tincidunt. Nulla eleifend nunc nec mi sodales consectetur id vitae nunc. Quisque risus turpis, dictum at sagittis non, ultricies quis quam. Suspendisse ac diam dapibus libero ultricies laoreet vitae nec mi. Morbi laoreet sollicitudin consectetur. Nullam fermentum bibendum quam, accumsan congue mi ullamcorper non. Quisque accumsan lorem vel felis hendrerit auctor. Nam elementum dolor vitae turpis feugiat dictum. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Nulla feugiat dolor non ligula vulputate facilisis. Praesent vulputate mi vel nisl luctus bibendum. Vivamus risus urna, accumsan ac sagittis vel, molestie et dolor. Nunc rhoncus accumsan velit sed dapibus. Nunc gravida placerat est. Aenean sodales sodales placerat. Proin in turpis et felis ornare vulputate. Integer gravida bibendum congue. Curabitur a magna non sem lacinia vulputate. Morbi pharetra, metus vel imperdiet vulputate, nibh leo dignissim arcu, sed lobortis sem mauris id massa.

Let’s use X as the pixel input and Y as the pixel output.

Brightness

X + brightness = Y

Increasing the brightness adds the input amount to the pixels. Using a negative causes the pixels to darken.

Technically, the term ‘brightness’ refers to the human perception of light. Intensity would be the correct word. Nuke’s colour grade node calls the process ‘offset’ (it can also be done using the ‘add’ node). Duis ullamcorper dignissim massa, sed gravida elit molestie eu. Cras vulputate, nunc eu accumsan euismod, odio tortor rutrum leo, nec egestas urna dui id nisl. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Integer sagittis, purus dictum porta gravida, lacus ante condimentum ante, id convallis leo mauris quis erat.

Gain

X * gain = Y

Nulla facilisi. Fusce commodo malesuada risus eu tincidunt. Nulla eleifend nunc nec mi sodales consectetur id vitae nunc. Quisque risus turpis, dictum at sagittis non, ultricies quis quam. Suspendisse ac diam dapibus libero ultricies laoreet vitae nec mi. Morbi laoreet sollicitudin consectetur. Nullam fermentum bibendum quam, accumsan congue mi ullamcorper non. Quisque accumsan lorem vel felis hendrerit auctor. Nam elementum dolor vitae turpis feugiat dictum. Pellentesque habitant morbi tristique senectus et netus et malesuada fames ac turpis egestas. Nulla feugiat dolor non ligula vulputate facilisis. Praesent vulputate mi vel nisl luctus bibendum. Vivamus risus urna, accumsan ac sagittis vel, molestie et dolor. Nunc rhoncus accumsan velit sed dapibus. Nunc gravida placerat est. Aenean sodales sodales placerat. Proin in turpis et felis ornare vulputate. Integer gravida bibendum congue. Curabitur a magna non sem lacinia vulputate. Morbi pharetra, metus vel imperdiet vulputate, nibh leo dignissim arcu, sed lobortis sem mauris id massa.

Gamma

X (1 / gamma) = Y

Technically, the term ‘brightness’ refers to the human perception of light. Intensity would be the correct word. Nuke’s colour grade node calls the process ‘offset’ (it can also be done using the ‘add’ node). Duis ullamcorper dignissim massa, sed gravida elit molestie eu. Cras vulputate, nunc eu accumsan euismod, odio tortor rutrum leo, nec egestas urna dui id nisl. Cum sociis natoque penatibus et magnis dis parturient montes, nascetur ridiculus mus. Integer sagittis, purus dictum porta gravida, lacus ante condimentum ante, id convallis leo mauris quis erat.

A lot of people mention this on forums and struggle to understand why it’s needed. Even after reading some books that touch upon it I was confused. Maybe I’m too stupid? Possibly. But I was frustrated by this so grabbed a pen and paper and did the maths myself, and it clicked.

Theory

A premultiplied images is an image that has the RGB multiplied by the alpha channel. This is usually for creating transparency when merging with a background (with the over operation). However problems occur when colour correcting the premultiplied image.

R * A = R
G * A = G
B * A = B

‘Unpremultiple’ is the process of dividing the alpha out of the image. Then the colour corrections can be done. After this stage, the alpha can then again be multiplied back in. This can often be done within the colour correction node itself, or manually.

Let’s look at an example.

R = 0.5
A = 0.2
X = 0.3

So I’ve set some variables. This example concentrates on just the red channel (R) and the alpha (A). The last variable is X, which is a colour correction value input by the user. In this example it is added (brightness increase) to the pixels.

Example 1 is what standardly happens; the alpha is premultiplied and then the brightness is added. Example 2 is what should happen; the alpha is removed, the colour correction performed, and then the alpha is put back.

Example 1:
R * A = 0.1
0.1 + X = 0.4

R = 0.3

Example 2:
R * A = 0.1
0.1 / A = 0.5
0.5 + X = 0.8
0.8 * 0.2 = 0.16

R = 0.16

Both equations run a brightness increase of 0.2 to the same pixels. However, the results are different!

You should notice how the red channel is changed by the alpha at the start of the equation, which changes the outcome after the brightness increase. Unpremultiplying removes this alpha so the red channel is effected how it should be.

The image becomes unpremultiplied, by performing a pre-divide. This is why Fusion calls the process ‘premultiply/predivide’ instead. Either way, both are correct terminology.

When you do these equations with the alpha and 1 or 0, the results are the same. Therefore if there is no semi-transparency it could be argued there is no need to do unpremultiply. Most premultiplied images will have semi-transparent areas, from blurred rotoscope edges to anti-aliased renders, so it is good practise to do so whenever the image is premultied.

Practicality

The effect is a brightening or darkening of transparent pixels. The greater the colour correction, the more noticeable it will become. An anti-aliased image will have a dark/light border around the render which will look nasty, especially when trying to blend it in with the environment.