I'm new to Blender, so forgive me if this is an easy one, but I've scoured the net and the various blender community sites and I haven't seen this particular question asked, so I'm posting.
Before diving into all of Blender's 3D modeling and rendering tools, I decided to tackle it from the perspective of video editing first. And for my very first project, all I want to do is load a video channel and drop some pop-up text boxes over it as it plays.
I've created my funky looking text bubbles and I've saved them out as transparent PNG files. Now all I want to do is load them in as strips in the VSE and composite them over my video strip. But after an entire day of trying to make it do what I want, I cannot get it to work. I have got the images loaded but Blender seems to be ignoring the alpha content of the PNG file and I can't figure out how to make it behave.
Can anybody tell me how to solve this?
Full disclosure: I'm an experience video editor and 3D animator, but a total noob with Blender.
In the VSE, add both strips and combine them with an AlphaOver effect.
You can also do a similar thing with compositing nodes.
Thanks for the quick reply. What you suggested is one of the techniques I've tried, but I had another stab at it based on your suggestion, and although it took me forever to sort out what was going wrong, I think I've solved my problem, and in the process may have found a bug. Here's what I've uncovered.
First, I'll state the workflow I was doing in Blender (for the benefit of anybody trying to solve the same problem later):
1) Load simple movie sequence into channel 1
2) Load a static image (which is the same resolution as my video sequence) into channel 2
3) Right click on ch1 video and shift-right-click on ch2 image to select both
4) Add > Effect > Alpha Over
5) Position play head to a point on the timeline that includes the ch2 image
The overlay image was created at the same resolution as the video, and has zero alpha everywhere except a small rectangle in one corner, which contains a white box with a black outline, a string of black text inside it, and a drop shadow behind the box.
I've actually tried this with text images created in a number of different ways (all generated from Inkscape). The breakthrough came when I noticed that I was able to see the video showing through in the text block's drop shadow, and this suggested to me that Blender does not handle all the different ways PNG can express alpha transparency. In particular, I'm guessing that Blender works fine with alpha that is encoded as part of the pixel color tuple, but that it completely ignores the alpha implied in a declared background transparency color.
But it gets weirder. If I express ZERO alpha throughout the image, Blender seems to ignore the alpha component completely. I actually have to specify an alpha value of 1 for the background to get it to process as alpha. Fortunately, a value of one is pretty much invisible to the human eye, so this is okay as a workaround, but it's kind of anti-elegant.
I'm guessing that somewhere in the bowels of Blender, it has logic to determine whether or not there is alpha in the image, and a value of zero alpha is interpreted as meaning no alpha channel present, rather than alpha present and set to zero.
In my view, this is a bug, but is it one of those things that people have known about for years and just developed coping strategies to deal with? Or is there some subtle reason for doing things this way that I've just overlooked?
Further update. The problem seems to be mostly with Inkscape and how it structures the transparency info. Overlay images created in Gimp seem to work just fine.
Thanks for the update. I have not had time to look into this. I do know I have used transparent PNGs created in GIMP or rendered in Blender with no problems. I wonder if we are dealing with an underspecified PNG format, an implementation bug or what?
I can confirm that this is a bug in blender's PNG-reading code. Probably something to do with premultiplied alpha. It's obviously a common bug, because OSX's image viewer does the same thing.
Render a semi-transparent image with blender and save it as a PNG (remember to select RGBA in the save dialog! it is reset to RGB every time, which is really annoying).
If you then open that with OSX's image preview, or in the blender VSE it ignores the alpha channel and makes it all opaque. However, if you open it in GIMP it displays correctly. If you resave it from GIMP it then works correctly in blender.
When saving in GIMP I turned off "Save background colour" and "Save transparent pixel colours" but I haven't investigated if they make any difference. I suspect it may be the background colour thing, in which case blender should really have a "use background colour" option for the image clip, or at least not use it by default.
Also worth playing with the "Premultiply" option in the "Colours" section of the strip properties. I think in fact that may be all you need... (not tested).
Ok, I just tested, and indeed all you need to do is select "Premultiply". I have no idea what it does, or how I should know to use it, but the day Blender gets decent documentation... well, that'll be a nice and unlikely day.
At a *guess*, I'd say blender's VSE only supports premultiplied alpha, and GIMP saves with premultiplied alpha. So if you open a file without premultiplied alpha (surely most of them?) then you have to manually premultiply it.