0
$\begingroup$

I'm having a rendered image including some transparency. The image in the Blender Render window is looking as follows and is like expected.

enter image description here

So this white frame is fading towards transparancy.

Now I'm saving this image as RGBA PNG.

When I'm loading this into other tools (such as GIMP) the transparency did increase in general. In GIMP (and other tools) this is looking like this: enter image description here

So what is to be more or less opaque is quite transparent now.

What can be to point here resp. what I possibly do wrong? I already played a bit with the color management settings of Blender while saving the image, but there does not seem to be a relation. Usually I'm using this very same image coming from a 3D Render Layers node within the node editor in order to combine it with other elements. Everything is working as expected there. But for yet unknown reasons I cannot export these intermediate images out of blender and process them elsewhere.

Any ideas?

Thanks, Mario

Updated Information: Here a screenshot of a Blender project showing relevant information to reproduce this effect easily. The project consists of a simple plane that is using a special material that fading from opaque to full transparancy. This is the same mechanism I'm using for the frame elements shown in the original case. enter image description here In GIMP the perception of the transparent area is significantly different, meaning it is fading to transparency much quicker.

Seems in GIMP the issue can be corrected by manipulating the alpha channel through the levels. Refer to this screenshot (associated with the original frame example): enter image description here I did not make a deep analysis yet. But it seems that an input level range of 0-50 does lead to the same perception as we find it in Blender directly.

Update: After doing more experiments and searches for possible solutions it turns out that this problem cannot be solved. Probably it is linked to somewhat known as "unassociated vs. associated alpha". For instance, here can be found a discussion with a different use-case but probably related to the same root-cause: https://blenderartists.org/t/blender-2-92-not-saving-alpha-values-properly/1303516/3 This probably as well: https://blenderartists.org/t/cycles-render-alpha-channel-file-png-problem/1148224

There are some ways to improve the situation, but it seems the exported pictures are always different. Resp. when pictures with transparency are being exported from Blender and imported into other programs, they appear different when overlaid with resp. onto other pictures in comparison to when the overlay would be done in Blender's compositor.

So general care has to be taken when exporting images with transparency from Blender. In my application case I had to export a certain 3D-scene that is normally being processed further within Blender's compositor. But I also had to use it in an external video cut program for overlay in some special cases. This is a thing that should not be done - especially not in frame-to-frame situations as there will be a cut visible in the final video. So either the overlay has to be done exclusively in Blender, or exclusively in the external program. While in the latter case it might be needed to do a special treatment of the alpha channel - either in Blender or in external program(s).

$\endgroup$
5
  • $\begingroup$ Not all tristimulus regions with alpha are equal. You’d need to supply more information such as quad values from the render and what you are seeing in the other software. There is a 90% chance that PNG and the other software is the culprit. $\endgroup$
    – troy_s
    Commented Apr 2, 2023 at 14:45
  • $\begingroup$ @troy_s Not sure what "quad values" means, but I added a simple blender setup that corresponds to my more complicated one and also shows the issue. Btw., I see the issue not just with PNG but also with other formats supporting transparency. Of course, this issue can be also related with the "other" software. In particular I'm seeing this with GIMP and Kdenlive (Video editor) and also with a simple image viewer (all under Linux). I doubt that they are all broken. I also don't think that this is a bug of Blender. Merely this is probably something I'm doing wrong.... $\endgroup$
    – Mario
    Commented Apr 2, 2023 at 16:25
  • $\begingroup$ Quad being RGBA. Blender, and any path tracing engine, uses proper alpha internally. You are fading the alpha, which means you are removing the occlusion but leaving the emission in tact. Blender cannot encode 8 bit files of this sort since a bad design choice years ago. The only way to encode this is in an EXR. And all of those software packages might break on loading it. You’d need to scale the RGB if you don’t want it to be an emission. As you interpolate the alpha to zero, the RGB remains emissive and the occlusion approaches zero. $\endgroup$
    – troy_s
    Commented Apr 4, 2023 at 3:39
  • $\begingroup$ @troy_s The issue is more or less the same whether the images are exported as PNG or OpenEXR. Though, the perception in OpenEXR is slightly different. In general it seems that this is an issue without a solution. I'll add a few remarks to my original question, hence rounding it up.... $\endgroup$
    – Mario
    Commented Apr 18, 2023 at 19:34
  • $\begingroup$ You will find almost all apps mishandle the alpha. If you were to test the EXR in Nuke for example, or Fusion, the result would be correct I suspect. $\endgroup$
    – troy_s
    Commented Apr 19, 2023 at 22:44

1 Answer 1

0
$\begingroup$

I ran into similar problem trying to render a diffuse color pass. I tried rendering workbench flat texture, as well as exporting through the compositor output nodes. Both methods added arbitrary transparency, especially in shadows.

The fix- Use two identical scenes in one file + composite.

  • Scene 1 - Turn transparency on in the Render Properties -> film Settings -> Transparent. This is just going to control your alpha, so you can use workbench/eevee.
  • Scene 2 - Turn transparency OFF. Render as nice as you need (If you're going Cycles, this is the scene you want that on)
  • Composite together- Create 2 render layer nodes, adding Scene 1 & Scene 2 into them.

From Scene 1 node, run the alpha through a Color Ramp node, which lets you play with the transparency, adding more or less (I used Constant, since I didn't any transparency on my objects).

Create a Set Alpha node, and plug the output into a File output node. For the inputs, plug the Color Ramp node Image output into the alpha input, and your render layer node for Scene 2 into the image input.

Compositor This fixed my issue! I hope it helps you and others!!

$\endgroup$

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .