View Full Version : Alpha premult in antialiasing?
I'm trying to do compositing work with some Cheetah3D renderings and real photographs. I'm getting noticeable borders in the antialiased limits of the renderings, a problem which looks like if it was related to alpha premult/nonpremult typical issues. However, perhaps the problem is more complex, as it could be related to how these border pixels are antialiased with the background: What does it happen with raytracing when you use antialiasing and your background is transparent?
Can anybody tell me what maths should I use for blending a Cheetah3D rendering on top of a real photograph? I'd expect something like CheetahRGB*CheetahAlpha + PhotoRGB*(255-CheetahAlpha), but this causes noticeable borders.
So... what maths should I use? (I've access to the compositing app source code, so I can adapt it to whatever blending formula)
One more note: If I open a Cheetah-rendered image with a paint app, and I look at RGB channels only, the antialiased borders of white primitives look like if they were alpha-premultiplied (because they show a gradient from white to black), but, however, the antialiased borders of black primitives have a gradient from black towards grey (or perhaps white?).
This confuses me, as it seems there's not a uniform criteria in all the pixels of the image.
you are right. That is indeed a problem at the moment. It is causes by the fact that both the color and the alpha channel are antialiased at the moment. For example you have a background with the following RGBA color (0,0,0,0). Now if the pixel at the boarder of a white ball will be antialiased not even the alpha value will be averaged during sampling that pixel multiple times. But also the color value. This causes that the color becomes grey at the boarder.
It would be better if only the alpha value would be averaged if the background is totally transparent. So the boader of the ball will stay white and the antialiasing happens in the alpha channel when you composite the scene.
I've put that onto the todo list. I even gave it a quite high priority.
The only interrim work around I can imagine would be to render the scene in a higher resolution with no antialiasing and than scale the image down in Photoshop.
I've done it assuming premult alpha, because it works acceptably for white surfaces, and I've a lot of them, but very few dark objects, so it's the best approach I can think of (re-rendering would be another as you suggested, but I'm not sure if I can afford brute-force antialiasing because I'm rendering at 3000x1000).
So, I've used CheetahRGB + (1-CheetahAlpha)*PhotoRGB.
It doesn't work fine for dark borders, but my scenes have only a few of them.
Thanks for the info!
that bug will be fixed in the next update. No boarders any longer when you composite Cheetah3D renderings which have a transparent background.
Sorry that it took so long.
vBulletin v3.6.0, Copyright ©2000-2013, Jelsoft Enterprises Ltd.