Page MenuHome

Z-Combine node ignores alpha values (including patch)
Closed, ResolvedPublic

Description

Seen with blender 2.54 svn r32610, 64bit linux
running and built under kubuntu 10.04 64bit
geforce gtx 460 with nvidia driver 256.53

The z-combine node in the compositor does not take any alpha values into account, thus making this node unusable when dealing with transparent objects.
It can be worked around by using the zmask ( or All-Z) feature and using alpha over, but i think this should also be handled by the z-combine node.

Since the source code doesn't seem to have changed since 2.49, this is also true for the current stable branch.

It may be a deliberate decision to ignore the alpha values, but nonetheless I have included a patch which corrects the problem (at least with the examples done by me so far)

See the attached blend file for an example. It has 3 planes. The top-front and far-back plane are rendered on one layer with the front plane having an alpha mapped texture applied. On a second layer the middle plane is rendered, also with an alpha mapped texture applied.
In the compositor these two layers are composited using the z-combine node. The behaviour with the current svn shows that the alpha values are ignored.

Event Timeline

Hi, thanks for including a patch, I looked over this and it seems straightforward enough but this isn't my area so assigning to Ton.

One issue to solve is that this option is new, and might break previous zcombine setups. An option "Use Alpha" would be nice then.

Thats certainly true. And the option should of course have the default to not using alpha.

Do you want me to revisit the changes and submit a patch including this option ?

That would rock! And make it work for 2.55 trunk :) UI works different now...

ok, I'll see what I can do. Is it ok to submit it here through the bug tracker ?

yes, i get the mails :)

I have implemented the 'use alpha' option in the zcombine node. I hope I have everything covered, I am not really sure if the changes to rna_properties.txt are needed and/or correct.

Anyway my tests look fine and compatibility with old files should be preserved.

The patch is built against svn 32975.

Thanks a lot Martin! Will apply in code now with credits.

Ton Roosendaal (ton) changed the task status from Unknown Status to Resolved.Nov 12 2010, 3:55 PM

Does this fix all the points of https://projects.blender.org/tracker/index.php?func=detail&aid=5189&group_id=9&atid=127 ? Asking, just to see if the other can be closed or still applies in part.

As far as I see it 2 of the points were already present in the code (output of combined z, antialiasing). This fix adds the support for transparency.

The last point mentioned (z data of premul images) is not handled, but I do not understand enough what is meant exactly by this point to give a definitive answer on that.