Real time pixelator

A faster version of my pixelator

Here’s the final product, you can either use your webcam or a static image.

The default picture is one that I took at Lake Valhalla in Washington.

I really liked the visual effect of my pixelator, but I wanted a version that was a lot faster and more suitable for implementing a real time effect over webcam input. So, I used webgl. I’m actually using one of my ongoing projects, a video sythesizer to implement the effect.

The one tricky part was passing an arbitrary list of colors to the fragment shader, which I addressed by shoving the list of colors into a 1-D texture and passing in a length to the shader to tell it how many values it should look up in the texture. It’s probably possible to get better preformance by sorting the list of colors, but the performance of this implementation is good enough for me.

Written on January 15, 2021