1

In Blender when rendering with Transparent background and saving transparency with .png file, is it possible to save the png with GIMP's option:

Save color values from transparent pixels ?

enter image description here

How to achieve Alpha 1 transparency with Blender compositor?

enter image description here

Wildfire
  • 400
  • 1
  • 5
  • 19
  • http://blender.stackexchange.com/questions/1303/can-blender-render-pngs-with-the-background-transparent/1307#1307 –  Dec 23 '16 at 17:34
  • "is it possible to save the png with GIMP's option" - can you clarify what is your question ? Which setting of GIMP are you referring to ? Why do you search for exact that setting inside of another program ? – Mr Zak Dec 23 '16 at 17:38
  • So, I would like to save transparent png image from Blender directly by saving color values from transparent pixels and not using GIMP or PS. Other solution is to have Superpng plugin for PS which I don't have. It has Alpha channel control. I would like to do this with Blender. – Wildfire Dec 23 '16 at 17:53
  • @cegaton I have rendered with transparency. I would like to save alpha chanel as well with transparency. – Wildfire Dec 23 '16 at 17:56
  • 1
    @DanMonsic If you are rendering with transparent background the background will have black color value. – Denis Dec 23 '16 at 18:00
  • Will it? I thought it has white. – Wildfire Dec 23 '16 at 18:06
  • I think it has white. I would like to have alpha background. – Wildfire Dec 23 '16 at 18:08
  • 1
    All that is necessary to save image with alpha channel is already described in the linked answer - enable RGBA for image file to be saved (works not only for .png which is best to avoid, but for all other image formats as well). If you save image which was rendered with Transparent enabled and check RGBA prior to saving your image will have alpha channel. – Mr Zak Dec 23 '16 at 18:14
  • @DanMonsic You would want 0 value for transparent areas for best results of math operations, which is black color. – Denis Dec 23 '16 at 18:22
  • How to get Alpha 1 transparency ? http://www.fnordware.com/superpng/out_dialog.png – Wildfire Dec 24 '16 at 00:21
  • Alpha 1 is solid, no transparency – Gez Dec 24 '16 at 01:13
  • 1
    unless Alpha 1 means 1-bit alpha. If that's the case, Blender does not produce that kind of images (paletted with 1 bit alpha). – Gez Dec 26 '16 at 02:53

1 Answers1

7

PNG is an unassociated alpha image format, while Blender, as any other 3D renderer produce associated (often called premultiplied) alpha images. To produce an unassociated alpha image using the compositor, you have to "pre-divide" the alpha channel and connect the unassociated RGB to the composite output and the alpha socket of the same node. You can unassociate the alpha channel using an Alpha convert node (using the "premul to straight" mode) or just divide the rendered image by its alpha with a mix node (divide mode).

That's the correct way to save unassociated from Blender if it has to be predivided manually for any reason, otherwise Blender does the predivision automatically when PNG is selected as output (and in that case it's not necessary to manually connect alpha to the output).

PNG will always save the RGB information of transparent pixels because it is an unassociated alpha format. However, producing an unassociated alpha image from an associated image is a destructive process, because it has to be divided (and alpha zero pixels are discarded). Saving an associated image as PNG is not allowed by the format, so it's important to keep in mind that any hack used to produce a PNG as described by the OP will produce an invalid image that is likely to produce edge artifacts when composited.

It is strongly advised to respect the alpha association dictated by the format and avoid this kind of hacks if PNG has to be used.

Gez
  • 2,220
  • 18
  • 27