Jump to content
Hash, Inc. Forums

Alpha channel embed???


detbear

Recommended Posts

I remember having trouble with this in the past, but I was hoping that it had been solved simply.

When I render an image file from Hash as a PNG, JPG, or other, the Alpha channel doesn't export automatically. As a result, when I import the image back into A:M to be used in a "Layer", it has black instead of transparency. If you have an Alpha channel set in the render, it should show up in the image as transparent. But in an A:M render this is not the case.

Am I missing something.

1. Render an object as a PNG with "Alpha" buffer set on.

2. Import that image back into A:M and create a layer with it in a Choreography.

3. Does the transparent area show up "black"???

4. In my opinion, it should automatically have the transparent Alpha channel working....Right??

 

Link to comment
Share on other sites

  • Hash Fellow

JPG never has an alpha channel. It can't.

I always render to TGA because it represents the alpha channel the same as it does the RGB channels and imposes no color management.

However, when i render an object in either TGA or PNG, the alpha channels both work as expected.

Load this PRJ and see if it displays like I have...

AlphaTest.zip

The top Chor is the model that got rendered to TGA and PNG.

The middle Chor is the TGA on a Layer.

the Bottom Chor is the PNG on a Layer.

image.png

 

Link to comment
Share on other sites

  • Hash Fellow

I put a PRJ up there for you to test. Test it.

 

8 minutes ago, detbear said:

I'm remembering also that for some reason the .TGA has a dark rim around the outer border that doesn't composite well when blended back into the same image.

That may be some setting I'm unaware of though.

Can you show this happening?

Link to comment
Share on other sites

Here is a sample of the original render with all rendered together. And the second is a render using the resulting .TGA on a layer.

Notice the dark border rim around the letters. That's hard to composite. The following has no rim because it was rendered without an alpha.

Hi Robert Combined0.jpg

 

The following has the odd resulting dark border:

 

Hi Robert combined strange dark border0.tga

 

Link to comment
Share on other sites

  • Hash Fellow

Change the setting for "Save with unpremultiplied alpha channel" to whatever isn't what you have it set at.

 

If you are using After Effects to composite, it has a setting to use either version of the Alpha channel...

image.png

 

Link to comment
Share on other sites

  • Hash Fellow

Here is a magnified comparison in After Effects.

The top images were rendered in A:M with  "Unpremultiplied Alpha Channel" OFF

The bottom  ones were rendered in A:M with  "Unpremultiplied Alpha Channel" ON

The left side has the wrong interpretation of each in After Effects chosen. The right side has the correct one.

Either can composite correctly with the right interpretation.

"Unpremultiplied Alpha Channel" ON is slightly more accurate for compositing purposes. The advantage of rendering with "Unpremultiplied Alpha Channel" OFF (the A:M default) is that outside of a compositing program the anti-aliasing of the object's edges still looks right.

image.png

 

Link to comment
Share on other sites

  • 2 weeks later...
  • Admin

The black outline is typically an indication of premultiplied alpha channels... and perhaps especially if/when the process of premultiplying the alpha channel has been done more than once.   Contrast this with a white outline which is an indicator that images are being used that are un-premultiplied and need to have that process applied in order to lose the outline.

 

Interestingly, this can go a lot deeper and even touch upon our favorite topic of... gamma correction! 

This wikipedia article provides some of the math involved: https://en.wikipedia.org/wiki/Alpha_compositing

Aside:  Something I learned from that article but probably should have known already:  Only the color channels get color corrected... the alpha channel is always linear.

 

Regarding the alpha channel... or the area that is normally transparent appearing as black... there are two primary things to consider here:

1) Programs need to display the transparent portion of an image in some way and black is often the default because the value zero (i.e. black) denotes complete transparency in the alpha channel versus the value 255 (white) denoting full opacity. 

2) Different programs deal with displaying transparency in different ways but in general the transparent area is logically read/interpreted as black although the area is still transparent in the original file. 

In other words, it can help to consider whether the image being seen has been fully processed (i.e. with premultiplied alpha*) versus the program processing to UI/display with the transparent area using a default color (usually black).  The area under consideration may in fact not be black but is simply being displayed with the default value of zero (black).  

Some programs use the checkerboard pattern to display that area instead although the smaller the icon the less likely that is to be the case as it can be hard to see a checkerboard pattern at small size.  

 

*In compositing it is often best to use images that are un-premulitplied so that we aren't dealing with combinations of the color channels being multiplied with that of the alpha channel... allowing the user to make the decision of when/where to initiate that rendering process.

 

 

Added:  Returning to this for a clarification (of sorts).  I suppose technically speaking the value of the alpha channel is a percentage from 0 to 1 and not a value from 0 to 255.  This gets a little confusing... again... because of how different programs display the values.  This is also why we might see percentages for transparency in HTML/CSS after RGB values.  It seems nothing is ever as simple as it should be.  ;)

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...