Odd Flickering in Compositor (Caused by Z-Values)

Here is a 2-second video. Note the pedal area on the exercise bikes, and the flickering that occurs:

https://youtu.be/_yikAtWZwMk

This is from a file with four different Render Layers (attached). There is one Render Layer with the exercise bikes where the pedals are stationary, and another where they’re spinning. The goal is to smoothly dissolve between these two layers. It is working pretty well…EXCEPT…for areas where the Z-values are intersecting (or some-such).

Here’s a screencap of the problem:

http://www.pasteall.org/pic/show.php?id=62462

Here is a screencap of the Node setup:

http://www.pasteall.org/pic/show.php?id=62464

So! The end goal is simply to dissolve between the bikes, once again. I suspect the final solution will involve Math Nodes doing something with the Z-values of the problem Render Layers (2 and 3). However, I don’t know the solution, which is why I’m here!

Thanks for your help, as always. (For the record, KHorseman at IRC was the one who zeroed in on the Z values being the cause of the flickering. So thanks, there.)

Using z-combine, you will always get some sort of artifacts… because z depth isnt truely antialiased… and as a result wont give a clean mask

but that being said what i would do is create a bunch of nodes to get it to the right stage, and hten animate a simple colour mix between them, that will give you the least amount of errors.

Ideally, you would render everything with holdout masks or layer masks at render time, and then just do a simple alpha over& animate the factor of that.

Yeah I don’t see the value of the z mix approach as it look snot much different to a straight fade from one to the next? Also the shadow under the seat in the left lower corner is quite distracting.

The solution was to use a “Normalize” Node. The Z-Values don’t just range between 0.00 and 1.00, like most other values. They climb much higher than 1.00. So, “Normalize” averages all the values between 0 and 1.

I believe that the cause of the flickering was that, although the Z-Values were smoothly transitioning from one to the other, because their range was so high (higher than 1.00, most of the time), it was always at full opacity when it averaged the two of them.

Note that, for some reason, I also needed to use the Normalize Node on the other Z Combine, too.