How do I get alpha of composite images with blur etc.?

I like to animate an object in blender and put some composite nodes together to make it look cool. Like blur, glare and stuff like that.

Then I want to export those images with transparency so I can put them over something else.

The problem is, saving as RGBA, only the alpha from the object is exported and the blur/glare effects OUTSIDE of the object bounderies get lost, because they have 0 alpha there.

Now my question is, is there a way to retain or generate the alpha for the effects, so that I have say a white glow around the object in the PNG like it looks in the output window?

This is not about how to achieve a glow on the object, when I use it afterwards. Yes, I probably could render it without effects and then put them on manually.
But its about the principle if Blender can do this.

Here my simple setup with the resulting image in photoshop in the lower left:

Probably the easiest way is to put the alpha channel through an effects node also. It can be recombined with the initial alpha & the RGB component in a number of ways – note the Alpha input on the Composite node, where a final composite alpha can be piped in.

I use lots of masking and processing of alpha channels for effects, and basically they can be treated much as RGB images are, since they are 8-bit greyscale afaik. Sometimes the numbers generated by running alpha through many nodes get outside of normal ranges and have to be clamped to avoid odd effects, but for the most part it’s pretty straightforward.

Blur does a good job of blurring the alpha, as does vector blur. Glare does not; feed it to a colorramp which is what I think chipmasque meant by an effects node.

I didn’t have any particular approach in mind (I usually have to experiment some to find the right one), but the main point is that the alpha channel can be manipulated in many ways as well as the RGB component – afaik you could even convert it to RGB if needed to work in a particular node, then back to greyscale and then to an alpha channel again. Lots of options.

correct; the colorramp node has both color and alpha as output, based on the color and alpha settings of the spectrum. The input is Fac which tells me the source image is converted to BW regardless of alpha.


I thought I’d give that a try, but it still looks like glare does not work correctly on the alpha. Consider my node setup. Why does the alpha fail to contain the glare processing?


ras_alpha_glare.blend (184 KB)

@ Atom: Set the Threshold level on the Glare node for the Alpha to a value between 0 and 1.0 (the range of values returned by the Alpha channel, I believe?) and then it works. You can also exaggerate the effect by using the Low/Fast option.

Not for me in 2.5 - I need to blur the alpha seperately :frowning:

I think that’s what he meant – afaik node operations affect only RGB and Alpha has to be treated separately, although I haven’t yet used all nodes, so that may not be 100% accurate.

use…the…colorramp…node…and note that from the default I set the alpha for black to 0.

and switch/always use premul or key when saving out images you will later composite; otherwise the sky color will be multiplied into your background color.


Thanks ChipMasque,

I set the threshold to 0.0, instead of the default of 1.0 for the glare node processing the alpha channel and it worked fine. Also using PapaSmurfs tip on using PreMul instead of sky for the background…


ras_alpha_glare_works.blend (185 KB)

@ PapaSmurf – I like the way your noodle creates the streaked alpha from the processed image, something I’ve also done now & then as needed, though with different circumstances and nodes. I’ll have to start using Colorramp more often, it seems very useful.