Spark AR — VHS Chroma Shift using Optical Flow

Josh Beckwith
Popul-AR
Published in
4 min readJan 4, 2021

I was playing around with the optical flow patch (part of Flowkit), and stumbled into this kind of color offset effect seen in VHS playback. It’s a five minute effect! Try it out.

Here’s the finished graph, which you’re welcome to grab as-is, but I’ll walk through each piece and explain what it does.

To start, I grab the optical flow patch and connect it with a camera texture, screen size, and a render pass / delay frame combo. It already looks dope!

To increase the dope-ness I’m going to add .5 so we can see the full range of colors (some of the values are negative, so we are going to lift them up into the visible range).

The addition of .5 was really just for demonstration purposes. Throw it in the trash! Now we can do an additive blend with the optical flow and camera texture. You’ll notice that some of the colors are darkening the image, despite being added to the camera texture. That’s the negative values at work!

To limit the effect to just left & right, red & cyan; I just set the y offset to zero. Easy!

Note: More on the negative colors–really it’s just a red color. There is no cyan. When you see the cyan it’s actually a negative red. Neat, right?

To add a fade effect, I’m using smooth step and clamp. The smooth step is a quick way to add contrast (making blacks blacker and whites whiter), and the clamp is applying the fade (lifting blacks and lowering whites). The end result is this kind of degraded look. This isn’t an exact science so just noodle the numbers until it looks dope.

SIDE RANT (OPTIONAL): You may have noticed that blend node at the end of the graph... It’s just there as the result of a paranoid habit. There is (was?) a bug that will show your effect’s demo video behind the effect, like there is some kind of transparency. The kicker is that it only happens on the published effect, so you will only see it after it’s live! It’s super frustrating, and certainly not something that would make a client happy, so I made it a habit to add extra black blend node at the end of my graphs.

That’s all there is to it! Here’s the final effect that I called Ezimbili, which means “both” in Zulu.

This effect is pretty neat on its own, but there’s a lot of room to build on top of it. There are a ton of weird artifacts show up in VHS playback. You could add some animated static noise, desaturate and/or offset the colors, and add some frame interlacing.

If you want to add some funky distortion to mimic VHS tracking, check out the Super Texture Distortion Shader that we detail in the Smoke Effect Tutorial.

The optical flow patch is just one piece of Flow Kit. Here’s a quick demo in case you’re curious.

--

--