View Full Version : Bug with Blender's Alpha calculation
Hunkadoodledoo 10-02-2005, 07:30 AM At first, I thought it was just my eyes or it was the only way it was supposed to happen, but when I render to RGBA in the Targa format, the edges of my objects are tainted with the world background color. It is as if the pixels at the edge of the model aren't propely having the world color subtracted. I don't know how one would fix this, but I am kinda checking to see if anyone else has encountered this problem. If you don't understand what I mean, here are two closeups of two renders of a plain red box with two different color world colors. The one on the left being blue and the one on the right being green. Check it:
http://www.valdosta.edu/%7Ejcfaulkn/images/alpha_bug.png
Maybe changing the order of the alpha calculation might help. I don't know, but I would like to help in any way.
|
|
NeOmega
10-02-2005, 08:20 AM
change the world background color to white?
Hunkadoodledoo
10-02-2005, 02:28 PM
Guess what happens then....The object is outlined in white....That isn't fun at all....This is what you get:
http://www.valdosta.edu/%7Ejcfaulkn/images/alpha_bug2.png
As you can see, there is still bleeding of the white background color onto the edge pixels of the object. It is a little harder to see, so in GIMP I added a new black layer underneath the box, and you can clearly see the white outline. If you were going to attempt to superimpose your render onto anything that had more than a single background color, you would still have an ugly, world colored frame.
artofwot
10-02-2005, 04:09 PM
http://www.FanFilmEngine.com/alpha_no_line.jpg
It would appear to be a problem with only the targa format (I'm not sure if you were saying you were only having problems with the targa format), as I rendered out a png with alpha, and it appears to be just fine.
just a question, have you activated either the Premul or Key options in the render window? if not, those might solve your problems.
Hunkadoodledoo
10-02-2005, 07:51 PM
Artofwot, if only changing formats solved my problems...(I have to admit that I didn't try the PNG format before I posted, I just assumed that Blender handled all the calculation before exporting to any certain filetype the same - shame on me), but even after trying the PNG format, there is still bleeding. I don't know what your world color is set to, but I would suggest changing it to a brilliant green or fucia and then try rerendering. As you can see, the PNG format still bleeds:
http://www.valdosta.edu/%7Ejcfaulkn/images/alpha_bug%28sky%29%28small%29.png
(That is a red cube with a blue world background - makes a purply edge left over.)
On the other hand, zdk1, you win the prize! Changing to premul makes a clean, un-color bled edge. Here:
http://www.valdosta.edu/%7Ejcfaulkn/images/alpha_bug%28premul%29%28small%29.png
Thanks everyone for your help! I hope this helps other people, too. Happiness!
NeOmega
10-02-2005, 08:00 PM
sure will... good thing to know and remember.
artofwot
10-02-2005, 11:51 PM
Oops... you're absolutely right, it was just the sky color I had it set to - you don't notice the blue-on-grey bleeding.
Ian Jones
10-08-2005, 02:28 AM
This is not a problem specific to blender, rather a global problem with compositing. People have the same problem in various software. It all to do with using pre-multiplied vs non-premultiplied alpha. It's fine to use either as long as your editing software is interpreting and dealing with the imported image properly. It is most likely that you are dealing with pre-multiplied alpha which upon import into photoshop is not being un-multiplied from the alpha. This leaves a visible halo / border around edges. It is also possible that photoshop is pre-multiplying and already multiplied alpha... causing even more problems.
Compositing software usually has import options which allow you to specify how you will be dealing with an image's alpha channel, After Effects for example allows you to right click > interpret footage and specify how to handle it. Now, I'm not particularily informed about the details of the whole process, nor entirely confident I have it 100% right but what I suggest you do is search for and read up about pre-multipled alpha, alpha compositing and the general compositing workflow.
Although you may not think your actually compositing when you are using your 3d renders with alpha in photoshop... in fact you really are compositing and as such the same techniques and concepts apply.
Apollux
10-08-2005, 09:41 AM
This is not a problem specific to blender, rather a global problem with compositing. People have the same problem in various software. It all to do with using pre-multiplied vs non-premultiplied alpha. It's fine to use either as long as your editing software is interpreting and dealing with the imported image properly. It is most likely that you are dealing with pre-multiplied alpha which upon import into photoshop is not being un-multiplied from the alpha. This leaves a visible halo / border around edges. It is also possible that photoshop is pre-multiplying and already multiplied alpha... causing even more problems.
Compositing software usually has import options which allow you to specify how you will be dealing with an image's alpha channel, After Effects for example allows you to right click > interpret footage and specify how to handle it. Now, I'm not particularily informed about the details of the whole process, nor entirely confident I have it 100% right but what I suggest you do is search for and read up about pre-multipled alpha, alpha compositing and the general compositing workflow.
Although you may not think your actually compositing when you are using your 3d renders with alpha in photoshop... in fact you really are compositing and as such the same techniques and concepts apply.
Thanks a lot for that info, the color bleeding has been driving me crazy for some time now.
CGTalk Moderation
10-08-2005, 09:41 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.
vBulletin v3.0.5, Copyright ©2000-2012, Jelsoft Enterprises Ltd.