Hi. I have rendered alpha image of aurora borealis that i created in blender. Render layer has alpha threshhold of 0.001. Everything works ok if i am using render layer node but once i save this layer as png image (everything ok - RGBA and transparent checked) and use image node to composit it over another layer - it just doesnt work. I CAN SEE MY ALPHA ONLY IF I ADD GAMMA NODE.
SO THIS IS HOW IT LOOKS WHEN I SWITCH TO IMAGE NODE
You are blasting your alpha with rgb black with the alpha over node. You should probably also look into rendering to openexr multilayer which will preserve all rendered layers and make life easier, but to do it with png it would look like this. I can’t find my stylus so you have to deal with my mouse writing.
I recalled that somebody mentioned if the images are semitransparent like this one (aurora) i should use instead of transparent pixels - black color so to render aurora over black background ( not transparent) and then use add node to composit it? Am i right? I think i should try this
Very small alpha value will probably collapse to 0 in 8bit png. Try an exr, see if problem is there with it also.
Use eyedropper tool to sample the pixels and see what the channel values are exactly, might help to troubleshoot the problem.
Btw, there is no such thing as a transparent pixel (as in transparent vs. black). A pixel has a color (rgb combination) and transparency value alpha. If image is premultiplied, rgb values of pixels where transparency is 0 will also become 0 (x*0=0). This is why the transparent part is black. If an image is used as premultiplied (either automatically or explicitly forcing it) but a pixel with alpha=0 has rgb values above 0, it starts to “emit” light. Standard over will never exceed the max brightness of fg and bg because it is just a linear interpolation. But this “hot” pixel with proportionally low alpha can generate additional “light”.
HERE IS THE PACKED BLEND FILE. SO just press F12 to render and save as png and try to composit and you will see that nothing works. Render layer will look ok will contain alpha but image - not.
Thank you guys for help. I really want understand what is going on to avois such mistakes in the future
By the way. Indeed what i mentioned above works. So aurora image with transparent background i failed to composit in Blender but aurora over black background works fine when composited with another layer by using add node.
The problem is that the rgb channels have values above 1.0 which will get clipped in png. Result is that your aurora loses brightness. One partial solution is to add an Alphaconvert node in the end and do a premultiply before saving, but this will not get the same result because there are some areas where alpha is 0 but rgb channels are not (refer to my previous comment for what it does). Premult drives these pixels to 0 and you lose some areas of aurora which is not good.
The only real solution if you want to over, not add, is to let go of the png and use exr. The size of exr is most probably smaller than png for 16bpc and you get all the goods that png can not deliver. I would actually consider png a legacy format for rendering if any compositing is going to happen and even if not, png has no advantage over exr at all (except that MS Paint reads it, which is nice).
Thanks, Kesonmis. Do you think it’s shouldn’t be get clipped RGB automatically? We used to do it manually in Blender by clicking clipping box on the node? So maybe I should report a bug?
Also thanks for EXR. I used it before and it works but only in Blender. But in case of images I can also export it into photoshop if I need.
By the way it’s not only solution. Another solution which is works great I mentioned above - IS to NOT SAVE AURORA ON TRANSPARENT BACKGROUND BUT TO SAVE IT ON BLACK BACKGROUND STRAIGHT AWAY. And then I can easily composition it with another layer by using Add node. By the way for some reason in this case everything works great and no values get clipped. I am curious why?
You can’t store unclipped values in png file, it is an integer storage with exact maximum value it can store when using some gamma transfer function. When saving, 1.0 is mapped to that max value. It would be possible to use some log encoding as dpx does with cineon log, but for png it is a non-standard transfer and you will have a hard time supporting it outside comp software. Or you could scale the rgb values with a small scalar like 0.2 that brings them below 1.0. And then reverse the scaling after reading the image. But it is all great butthurt you can prevent with an industrial(-strength) light and magic format discussed earlier.
Add works because you already multiply your rgb with alpha when saving only rgb and it prevents the clipping. This is the same reason that adding a premult in the end prevents clipping. The results of add and over are different though, depending on your composite it works or not. For aurora it works as aurora is an additive element (generates light).