Jump to content
Hash, Inc. - Animation:Master

Alpha channels movie tutorial?


heyvern

Recommended Posts

I just put these two clips together. I am trying to come up with a simple demonstration of Photoshop like image with an alpha channel and why people get those "fringies" and don't know or understand why.

 

Let me know if this is getting the idea across at all...

 

...uh.. they were done in AM of course, with layers... except the titles...

 

Fringies! AAAHHHHGGGG!

 

YeeHaaa! No fringies!

 

I plan to expand this into a larger, more in depth explanation.

 

Vernon "!" Zehr

Link to comment
Share on other sites

  • Replies 15
  • Created
  • Last Reply

Top Posters In This Topic

I LOVED THAT!

 

"I'm gonna wash those fringies right outta my file" (TV jingle)

 

The concept you are illustrating, I believe, is called 'Pre-multiplying'... If your file is not uni-colored I find it helps to 'premultiply' (make the background color) a 50% grey.

 

know what I mean---?

Link to comment
Share on other sites

Nice demos, Vern. :)

 

Maybe you could do a close-up and point out the anti-aliasing, which is what is causing the halo. You know, show the aa with a white background, (blending edge pixels to white), and the aa with an alpha background to show clearly what is actually being captured.

 

You know, I think this halo effect is often caused by people using images which have had their backgrounds knocked out but are then saved without the alpha channel. The next time they come to use the image they either apply it and try to set the key colour to match the background, which only picks up one colour and not all the blends from the aa ... or ... they try to mask off the image again with the wand in PS, save as 32bit TGA and then are surprised when they see those edge blends appear on their decals.

 

By the way, did you use A:M for the text too?

Link to comment
Share on other sites

I know how to use Photoshop -- a little, and understand these little movies. But what about those that have no clue about PS. I would make a longer movie showing how you did it for those that have no clue:). Otherwise it's nice and simple and easy to see -- for me at least.

Link to comment
Share on other sites

Thanks for the early comments...

 

Never even thought about ghosting, Yves. I don't see any ghosting on any of my computers, including my PC. The background color at the end is blue actually. Very very blue. You may need to calibrate. On my Mac it appears just slightly leaning towards teal. On my PC it looks like a dark blue.

 

there is some "ghosting" of sorts on the no_fringies.mov. Where the magenta overlaps the blue at the edges it gets darker. On the other one it should appear as a white fringe.

 

Can others confirm this? Maybe I am losing my color sense.

 

Yes Paul, a close up would help. I was thinking of putting together a web page for this so I could have that part as an image.

 

As for how this happens... yes, it happens using the magic wand tool, using a key color in AM, all of these. I find though that there seems to be this very basic misunderstanding of how the image and the alpha work together. I have been using PS since version 1 when we didn't have layers, only alpha channels, for compositing. I caught on to this concept ages ago.

 

Not sure Mr. Bigboote (I forget who you really are! Sorry!) if we are talking about the same thing. If you use a 50% grey background you would just end up with a 50% grey fringe. My understanding of pre-multiplied from some research indicates you need some of the image to "overlap" the alpha.

 

I have seen examples of pre-multiplied alpha produced by other 3-D applications that actually "extend" the image past the edges of the transparency.... but that is another story entirely.

 

Vernon "!" Zehr

Link to comment
Share on other sites

For an explanation of what premultiply mean, I invite you to check my toturial on alpha channels.

 

What is demonstrated in Vern's clips is indeed related to premultiplying. But for a premultiplied image, the background would need to be black. Not 50%grey. But in A:M you would get black fringes anyway. There is no way out of the fringes.

 

The problem is not with A:M but with Photoshop which does not allow you to specify if the image you save is premultiplied or not. The premultiply flag in the targa file saved by Photoshop is always set to non-premultiply.

 

So because of that, you need to build your photoshop image in a non-premultiplied way. Which is what Vern's clips show.

 

About the ghosting.

 

Ah the joy of making graphics for monitor viewing. On my PC, the background appears turquoise actually. But I tend to call any mix of blue and yellow as green.

 

Still opposing magenta and blue is difficult for the eyes. Especially for color blind peoples. But even for normal vision people, red and blue does produce ghosting and even flashes. And then there is this very technical problem of trying to make the RGB channels to behave in situations where the two colors are mainly using very different channels.

 

The ghosting I'm talking about is : on the nofringies, I get darker edge on the right side of the border where magenta meet the background and lighter edges on the left side.

 

I invite you to take a look at this earlier thread where this opposing channels was discussed at length.

Link to comment
Share on other sites

GREAT OOGLY MOOGLY!

 

I think I finally understand now!

 

Premultiplied against black... I understand it now!

 

Photoshop was the monkey wrench. I always just made an "ASS" out of "U" and "ME" that Photoshop was capable of producing premultiplied images.

 

I never gave it a thought that it was... "different" than any other kind of compositing.

 

Premultiplied against black... is... well... uh... I understand it now! I won't try to explain it...

 

No wonder I was so confused!

 

MY GOODNESS! I feel like a total idiot now! I am so ashamed... I owe an apology to Hash about this as well... oh I am a silly man....

 

I was rendering out using alpha in AM.... in most cases I batch processed via photoshop! That is why I kept losing the premultiplied aspect of the Targa format!!!!!!

 

Maybe I have been wrong in other areas.... maybe there really IS a Loc Nes monster... maybe fairies really do exist! That shiny ball I saw in the sky at night could have been aliens, not a meteor... Maybe... Santa Claus... is REAL!

 

My belief system has been turned on its head...

 

Thanks Yves!

 

p.s. For better or worse Yves, for some reason I never doubt a single word you say. I don't know what it is about you, but I never have any doubts that you are correct. I may not understand everything you say, but I believe you.

 

Your posts seem to lead eventually to some new discovery.

 

I will change those colors!

 

Vernon "I do believe in ghosts... I do I do!" Zehr

Link to comment
Share on other sites

I'm probably speaking a bit out of turn here, but here's a hypothesis based on searching to see how GIMP handled pre-multiplied .TGA files.

 

I didn't find much information, but someone was mentioning that while premultiplying can save a little time in compositing, it also is a loss of color resolution (not pixel resolution).

 

My hypothesis is why the still programs don't assume pre-multiply and the video ones do:

All the paint(still image) people care alot about every bit of color precision and only at the final output step will they do any lossy compression or downgrading of image/color resolution (downsampled of course).

In addition, Video people know that large amounts of compression are necessary just to work with the clips often times and they also know that motion can reduce perceptual color resolution so they don't care as much about keeping high degrees of precision for color and they want to save time anywhere they can.

 

Video, of course, needs to use stills often, but when still work involves video footage, I'm guessing it rarely comes with an alpha channel. This is why video programs care about the pre-multiply and adjust accordingly and paint programs don't.

 

 

just alot of speculation, but my 2 cents.

 

eric

Link to comment
Share on other sites

Paint programs assume non-premultiply because that is the way they fundamentally work. When you erase on a layer. you are actually painting in the alpha channel of the layer. That is: the transparency channel is an alpha channel. Same thing when you add a layer mask. You then make an explicit alpha channel. Yet again the same thing when you use a soft brush. The brush is actually solid but its alpha channel is a radial gradient.

 

For the layer merge operations to produce the final image, all the image data needs to be non-premultiplied. Paint applications need to fundamentally work this way because they allow you to do the painting. It is not only designed to make compositing.

 

It is true, though that premultiplying an image reduces the color resolution. However, the places where the resolution is reduced the most is precisely where they contribute the less in the final composition. Ultimately, a pixel that contributes nothing is black. That is its color resolution is zero bits. This is why, it is possible to un-premultiply the image data, even though they have lost color resolution, and still have very valid image data for compositing.

Link to comment
Share on other sites

I was googling around a bit more and even though some of the tidbits I read implied that Gimp 2.0 and above might correctly de-multiply the alphas on open, it doesn't seem to work, but then I really don't think I know what I'm doing.

 

I also found this interesting tidbit about the history of alphas and pre-multiplying....all to save a few operations ;)

 

ftp://ftp.alvyray.com/Acrobat/7_Alpha.pdf

 

This one is interesting too:

 

ftp://ftp.alvyray.com/Acrobat/4_Comp.pdf

 

eric

Link to comment
Share on other sites

Here's something else that might help: if you have a Photoshop layer with a transparent background, you can choose Load Selection, pick the layer's Transparency from the drop-down menu, and save that selection as an alpha channel. Then, on the original layer, you can apply a free plugin from Flaming Pear Software called Solidify, which is part of their freebies pack. This extends the outline of the opaque part of the layer until it fills in all the transparent parts. Save that as a Targa with an alpha channel, and fringies become a non-issue.

Link to comment
Share on other sites

Good grief!

 

I started this thread in the hopes of helping others learn something...

 

Now I am learning more than I thought I knew all along!

 

Thanks for that plugin link Julian! That is fantastic! Sure saves a ton of time.

 

I love this place...

 

Vernon "!" Zehr

Link to comment
Share on other sites

Here's one more "fun" thing if anyone cares :)

 

After having figured out that GIMP isn't smart enough to de-multiply(just like photoshop), I knew that I could make a script or plugin to do it. However their script registry seems to be down at the moment and I ended up on ImageMagick.

 

I came up with this command line to de-multiply the alpha with ImageMagick

 

convert input.tga -fx "u*min(100000*a,(1.0/(max(a,.00001))))" output.tga

 

I spose it's a little esoteric, but it also allows you to batch process things if need be.

 

the "min" part isn't strictly necessary, I spose, but I didn't know what you'd want to multiply the pixels by if the alpha is 0. I guess on the one hand the RGB data should be 0 if the alpha is 0, especially if it's pre-multiplied. With the "min" portion, it'll make sure.

 

 

 

eric

Link to comment
Share on other sites

Wot? :blink:

 

First when I watched Vern's flicks I couldn't quite make them out - but I wanted to. Then when I read the threads I got even more confused until I re-read them now I think it has sunk in B)

 

I still need to read Yves tut on alpha channels to get my head completely around this pre-multiplied concept.

 

Anyway, now Mr thicky has worked it out I take a bow and thank Vern, Yves and all the others for showing me the light, or should I say alpha, or is that premultipled alpha... :unsure:

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...