Tip:
Highlight text to annotate it
X
Hello guys, I'm Magno Borgo
and this is another Compositing tutorial
Today I will talk about the premultiplication
premultiplication is an element that is
always present in Compositing, in image manipulation.
specially on images generated by computer graphics apps
If you do not know it
you'll go through several problems
that could be avoided
Let's start with a classic example
that illustrates pre-multiplication problems
I have this 3D rendered image
with an alpha channel
if you look here at the "channels"
there is the alpha
I you click ctrl (cmd) + click to load selection from alpha
and apply this alpha as a mask
to be able to compose this image
on top of another image
I will create a background here
and apply a white color
when you look at the composition
of this image over the other
we have a black halo around the image
this is a typical premultiplication problem (double premult)
to understand why this is happening
I'll show to you what pre-multiplication is
the name "premultiply"
comes from: "a previously made multiplication"
What is being multiplied?
to compose an image on top of another one
the RGB channels are multiplied by the alpha
to create the "transparency/opacity"
We're talking about CG generated images
texts, 3D renderings ...
this alpha channel will determine the image transparency.
Where we have white pixels
it will be fully opaque
where we have black pixels
it will be fully transparent
and where there are intermediate values
for example at the edge of these objects
these shades of gray
the pixel will be semi-transparent
ok, the alpha channel is required to make
transparency, then we multiply the R, G, B
by the alpha
However there are situations where the images
are already multiplied
which is the case for all images
coming from 3D renders
mental ray, vray, etc ....
most 3d renders already provide
the render premultiplied
In this case, the RGB channels are multiplied by the alpha
I'll open an image without premultiplication
the picture looks very strange
because the areas which should be semi-transparent
were not yet been multiplied by alpha
in the case of this image, which is defocused
we can see a solid area
at the edges of objects
I'm using this defocused 3D render example
because it is easy to see the premultiply effect
if we look at the alpha of this image
...let's take a look on the alpha here
everything is ok
then this is an image that we call
unpremultiplied
ie, no pre-multiplication
if the pre-multiplication causes so many problems
could we then render
images without pre-multiplication
this is actually a valid question
but the answer is no
because independently of the image
when you are composing it on top of another
you need to make use of the transparency (alpha)
and when you multiply the RGB channels by the alpha
problems can still arise.
So how do we work with this?
Why we have this black halo around the image?
it usually arises because the image
is already premultiplyed
and you are multiplying again the alpha channel on top of the same image
which has been pre-multiplied
it's like you had applied the alpha channel 2 times
and the main result is as follows:
when you multiply any number
for values lower than 1
that value will become increasingly lower
think with me:
I have a white pixel, the value is 1
multiplied by an alpha of 0.5
it becomes half the value
take this result
and multiply by 0.5 again
it will become half this amount
0.25, so after each new multiplication
this value will become smaller
and when a value approaches zero
it will darken the pixel
that is what is happening here
I had white pixels
which was made half
and then I applied again the alpha
and this value has become smaller: darker
because of that we have the black halo
How can we solve this problem here in Photoshop?
it's simple
I'll undo some steps
I will delete the mask
when you bring one 3D image for the PS
that is already pre-multiplied
you will remove this pre-multiplication
and the operation that is the inverse of the multiply
is the division, so let us first
divide this by the alpha
this will be "unpremultiplied"
and then we apply the transparency (Alpha) to this layer
the easiest way to do this
is to come here on the menu Image> Apply Image
we'll use the layer0
and we will do the operation with the alpha
the image alpha
and the operation we use is
"Divide"
so we're dividing the layer 0 (rgb) by alpha
OK ... see that when I do this
the picture becomes much like the other
What is the image without premultiplication
and now I'll get the alpha channel
load it by pressing ctrl (or cmd)
and will apply it as a layer mask
Look: now the composition is perfect
we no longer have the black halo
as the multiplication of the RGB with alpha
was done only once
everytime you manipulate an image
if it is already pre-multiplied you can
remove the multiplication by dividing it by the alpha
Keeping in mind that when the image
is premultiplied, the RGB values of semi-transparent pixels
are not the original values (RGB)
you have to be aware of that when doing
color correction on the image
because all these semi-transparent pixels
are not the original color
and this may result in incorrect colors
it will be usually necessary to remove the
pre-multiplication to do the color correction
and then do the compositing
I hope that this tutorial has helped clarify
doubts on this subject
a hug
and see you on the next tutorial!
for more training: http://www.training.borgo.tv
Don't forget to subscribe to the channel!
Subtitles by the Amara.org community