In a previous thread I inquired about the topic of making the sky of scenes transparent. I figured it out with the help of others.
However, this only works for some applications.
If you represent alpha as a decimal between 0 and 1, you can do things like shadows and antialiased transparency edges. However, in the solution described in the thread, shadows were a boolean instead: Either one or zero. So it’s totally transparent or it isn’t at all. That means that everything has a fringe unless I turn antialiasing off (which gives it rough edges) and shadows always look like dark blue blobs with rough edges.
How can I fix this?
thats what straight alpha and premultiplied alpha is for.
straight alpha does not change the color value at antialiased edges just decreases the alpha.
premultiplied alpha actually changes the color of the antialiased edge and mixes it with the underlying color that the antialiase fades to in the image.
sky alpha is premultiplied alpha that fades to sky color.
so best result would be straight, but not all externall comp apps understand this type.
Another way to think of “straight” vs. “premultiplied” alpha is to consider how you might represent a pixel that is a solid-red ghost (50% transparency).
A “straight alpha” pixel (R,G,B,A) would be: (1.0, 0, 0, 0.5). Which is fine except for the fact that, to get the “final” amount of R, G, and B, you have to do three floating-point multiplications.
A “premultiplied” pixel would be: (0.5, 0, 0, 0.5). Here, the multiplication has been done already: the R value of “0.5” can simply be used as-is. And, the alpha-factor that was used is conveniently supplied, unchanged, so that the operation can be reversed (without any data-loss) if necessary.
The trick is, there’s no way to tell whether a particular (R,G,B,A) tuple has been premultiplied or not. The four numbers look the same to the computer. So, you simply have to know how the alpha information is being handled, throughout the pipeline. Blender’s node-system gives you all of the tools that you need to accomplish this. So do all the other applications. But it can be tricky. I usually sketch out a diagram of what I have in mind (on paper!) then look it over carefully. I usually wind up separating-out the alpha (masking) information and dealing with it separately because, as you have seen, it can “accumulate” in pesky ways that you really don’t want.
I’m not sure how to do this… I’ve never used nodes even once.
Does a tutorial exist on the wiki for this? I’m trying again and I need help.
EDIT: I have found a post which says there is a premultiply option in the render settings; I’ll try that out and see if it works.