The Aha moment, part 5

Back then everything was expensive — not only computation, but also computer memory. So when I wanted to look at just a rectangle within an image, it wasn’t so easy, because in order to save space, images were all run length encoded.

So to get to the right set of pixels within each scan line of an image, I needed to do some work. First I had to find the right place in the run length encoding where my rectangle started, then I needed to chop something up in the middle, all of which was kind of a pain.

I remember staring at my screen and wishing that I could just put an “if statement” at every pixel. I could then just check each pixel to see whether it was inside the rectangle. That would be so much easier.

And that’s the moment when it hit me: If I could write a custom computer program that would run at every pixel that would be part of the content of the image — not just as part of the underlying system — then I could have as many if statements as I wanted. And I could also have loops, and variables, and procedures, and all of the other power that you get from a programming language.

That was the Aha moment — the moment when I invented the concept of a shader language, although I didn’t call it that — I called it a pixel editor. Of all of the things I’ve contributed to the field of computer graphics, coming up with what we now call shaders was by far the most important.

I spent the next month or two implementing my own interpreted language on top of Fortran, specifically to run at every pixel. It had many of the features we now associate with shader languages, like having vectors and matrices built right into the language, as well as lots of built in operations between vectors and matrices.

I then spent several happy months wearing my artist’s hat, creating the world’s first procedural shader based images (I’ve pasted one of them below). And in the years since then, shaders have become a mainstay of computer graphics, and have led to the rise of multi-billion dollar companies.

But it all started in that single moment, when I realized that I wanted to write an “if statement” at every pixel.

One thought on “The Aha moment, part 5”

Leave a Reply

Your email address will not be published. Required fields are marked *