View Full Version : Edge-bleeding when compositing with alphas (n00b alert!)

01 January 2003, 10:01 PM
This has bugged me for some time now, you people know that "bleeding" of color you get when you i.e. take a ball out of a scene with alpha, and then attach the ball to another scene.
Ok I'm so sleepy right now that I'm not exactly sure where the bleeding occurs (:)), I think in both the original scene (Outside the reach of the alpha) and the object taken out (Within the reach of the alpha... in previous example the ball obviosly)

Well, as combining stuff is really essential, I just can't understand how you people do it because of that bleeding caused by AA? I know you can prevent this by rendering with no AA, but I don't think this is the case?

Hmmm... I think I just explained this problem the hardest way possible, so if none of you understood this 'till tomorrow, I'll make an example pic for you... but now I'm off to bed...

01 January 2003, 09:58 AM
hmmmm i just woke up so its a bit hard for me to understand what you mean

if it s a render problem (like rendering a ball in 3d)
you can solve it by rendering it as )straight notpremultiplied

straight : all the information of rendering are in the rgb channel
so when you look at it without an alpha channel, the edge are very sharp and bright.
when you compoz it with an alpha it looks exactly the way you made it
try to make a lens flare in after effect and render it as straight
plus alpha then import it in photoshop (you will see what i mean

premultiplied your render is flatten on a color that you
choose so you may have a this color spill when you are putting
your object on a different background.

if it s not a rendering pb
let say you have to extract a car from a sky background.and you want to put your car in front of a dark wall.
you can extract it very accuratly from your sky background
you will have bright pixel on the edge of your car (thats perfectly

the thing you can do

extract the car the best you can.
put it on your second background
then you can erode the white pixel (can work)
or/and darken the white pixel
or/and change the hue saturation/level etc on the edge

hope that help

got to have cofee now

c u

01 January 2003, 03:37 PM
Interesting, I think that premultiplied/straight thing is just the thing I explained, and if I understood correctly I've always rendered everything premultiplied... Well now I need to find the way how to render "straight" in LW...

Well I'll do an example image later today and post it, but I think that premultiplying is the problem.

01 January 2003, 09:53 AM
Cheers guys,

My experience with premultiplied/non-premultiplied alpha channels is somewhat different:

Whether the edge is blurred or not, in the rendering, is not a matter of premultiplied vs. non-premultiplied, but whether you render "non-antialiased" or not. That's what the option is called in 3DS Max anyway. But that'll leave you with some non-antialias artifacts you'd really want to avoid.

However, what you want to do is to have your COMPOSITING program interpret the alpha channel as premultiplied, and then indicate the background color of your rendering.

What premultiplied and non-premultiplied means in my world is, non-premultiplied does the compositing basic and straightforward, and leaves edge bleeding on antialiased edges.

However, premultiplied knows that if a certain pixel has, say 50% transparency (based on the alpha value), and you've indicated that the background color is, say, black, then the compositing program will KNOW to remove 50% BLACK from the picture source's pixel, hence only compositing the REAL color value at 50%. (I know it may sound gibberish to REMOVE BLACK VALUES from a pixel, but it really does make sense... ;))

So my advice:
Render PREMULTIPLIED, and tell your compositing package to interpret the alpha channel as PREMULTIPLIED, and also tell it which background color the rendering has.

Then you'll be fine, no bleeding edges.

(other packages may behave differently, but the above solutions works perfectly with Max -> After Effects)

- Jonas

01 January 2003, 12:15 PM
yes you are totally right

but i think people dont understand the premultiplied/straight thing until they have to compoz.

after effect do the trick very well but not shake or edit box or even the flame

and photoshop is not very clever with premultiplied when the background is not black or white

i spend my days recovering layers from 3d software made by 3d
guys and try to correct the edges.
so i ask them to calculate their stuff in straight mode and
(almost) everthing is fine now.

but your explanation on premult is better than mine :beer:


CGTalk Moderation
01 January 2006, 06:00 AM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.