Thursday 28 June 2007

You like Shake's SmoothCam but SmoothCam doesn't like your 8bit images

A couple of months ago i came across a problem in Shake with the SmoothCam node, kinda solved it and forgot about it. Sometimes it's good to write down some bug workarounds down so you don't forget about them. So here is the problem:

I had to apply the SmoothCam node to some Roto mattes and i got a strange result. The SmoothCam node introduced artifacts in the RGBA channels.
Instead of being nice and having a value of 1.0 there were a lot of pixels that now had values of 0.996 forming patterns which changed for every frame.
Depending on the SmoothCam settings i got different results.

Here's one result when feeding a white (1.0) Color node into a SmoothCam node in 8bit:








I've added an Expand with the Low Color set to 0.95 so the artifacts are easier to see. The first is the result with only translateLock activated the second with all locks switched on. Setting it to smooth produces similar results.

The hideous thing is that you might not easily see these artifacts on regular images and maybe have introduced these without even realizing it.

So what is the workaround?
The good news is that these artifacts don't occur when working in 16bit or float.That means when working in 8bit you can just add a byte node set to 16bit before the SmoothCam and then add a byte node after that to bring it back to 8bit.

I've never read about this bug anywhere else and as we all know, it will probably never be fixed.