Once upon a time, in an online chatroom not so long ago, I was discussing philosophy with a friend. He said that, at the end of the day, philosophy is very speculative. It is hard to know which opinion is true. So, he decided, what is really important is whether an idea is useful. That way at least we get something out of the idea, even if we don’t know whether it is true.
Strangely enough, this way of thinking makes ancient philosophy relevant, despite being contrary to modern physics. In particular, it becomes relevant for modern graphics programming. The amazing computer-generated effects you see in almost every blockbuster today are only possible thanks to ideas proposed over 2300 years ago.
In a very old piece of Greek philosophical literature titled “Timaeus“, written in 360 B.C., there is an interesting discussion about the formation of the universe from first principles. In the dialogue, the interlocutors realize what they are saying is not necessarily reality, but they are happy with at least achieving a likely story about how reality operates with the data they have on hand. There are three relevant passages, which I’ll paraphrase due to length and sophisticated terminology.
In the first passage, the interlocutors discuss the creation of the world (which they believe to be a globe since a sphere is the most perfect shape). There are three main components to the creation. The first is the creator, called the demiurge. The second is the blueprint from which he creates. Since nothing exists yet, the blueprint consists of abstract concepts called “the forms.” The third and final piece is the material that the demiurge uses to craft the world. The demiurge embeds the forms into matter to create everything we see around us. In our modern language, these components are mind, ideas, and matter. You might notice strong similarities to the modern concept of intelligent design.
In the second passage, the discussion centers around the composition of matter. They propose matter is made of progressively more complex geometrical shapes. The simplest such shape is the triangle, and thus everything is ultimately composed of triangles. The triangles, are built into three-dimensional volumes, which is where we get the term “Platonic solids.”
In the third passage, the interlocutors are discussing the inhabitants of the world. They are theorizing about how an individual sees the world around him. Sight is the most important sense, because from sight comes philosophy, which makes the discussion possible in the first place.
“The sight in my opinion is the source of the greatest benefit to us, for had we never seen the stars, and the sun, and the heaven, none of the words which we have spoken about the universe would ever have been uttered. But now the sight of day and night, and the months and the revolutions of the years, have created number, and have given us a conception of time, and the power of enquiring about the nature of the universe; and from this source we have derived philosophy, than which no greater good ever was or will be given by the gods to mortal man.”The Internet Classics Archive | Timaeus by Plato (mit.edu)
The interesting thing is perception works completely backward to how modern physics tells us it happens. Modern physics says light sources emit photons, which get absorbed, reflected, or refracted. Once a photon hits our eye after this tumultuous journey, that’s how we see. One photon will only register as a spark of light, but half a billion photons hitting our eye every second generate the images we see.
What’s That Have to Do With Graphics Programming?
However, in Timaeus, the journey is reversed. Instead of the eye being a receiver of photons, the interlocutors propose a system where the eye sends out a beam to examine the world. When the world is lit, the eye beam will fuse with the light source, and when it comes in contact with an object, the beam transmits information from the object back to the soul.
Now, what do these three passages, from a piece of literature older than every country in the world, have to do with graphics programming?
In graphics programming, the task is to draw a flat two-dimensional view of a voluminous three-dimensional scene. It is like a photographer taking a picture of a mathematically generated landscape. If a programmer were to do this task according to modern physics, it would be completely impossible. He would have to send out an unfathomable number of rays from light sources in order to have just a portion hit the camera lens. This would require more computers than exist on the entire planet.
In 1968, a graphics researcher by the name of Arthur Appel stumbled upon a brilliant idea. What if the problem were reversed? Instead of tracing the path of a photon from a light source, trace the path from the observer to the light source, just as proposed 2300 years earlier by an ancient philosopher unfamiliar with modern science. Now, only one ray per image pixel was required, and it became possible to make realistic graphics with the computers of that era. This technique became known as raytracing. The original paper by Appel is a more technical, but still succinct read. 12 years later a short raytraced animation was created by Turner Whitted using Appel’s technique.
However, even with this massive speedup, raytracing was still too time-consuming to use for long-running computer-animated films. In 1987, an algorithm known as Reyes was invented by the company that became Pixar to render photorealistic computer graphics fast enough to create feature-length films. This algorithm echoed another insight from Timaeus. Along with tracing rays, it would take the three-dimensional objects, and decompose them into the smallest possible primitive objects: quadrilaterals (two triangles stuck together on their long sides). The advantage of using quadrilaterals over arbitrary three-dimensional objects is now there is a single kind of simple, well-defined shape. Instead of every ray having to be handcrafted, millions of rays can be processed at the same time with thousands of parallel assembly lines in the graphics factory. These quadrilaterals are smaller than can be seen, and by such fine decomposition, highly realistic renderings could be created quickly using raytracing. Pixar used the Reyes algorithm to animate Toy Story, and pretty much every major movie with CGI since then has used the Pixar software RenderMan.
Even with all these clever innovations, the question remains, how are such detailed and diverse objects created in the first place? Do computer animators have to create each little quadrilateral individually? Such a task would take longer than the lifetime of the universe to create even one frame of animation.
Instead, animators use the demiurge’s approach. They define abstract concepts from which all the visible properties are derived, very analogous to the forms the demiurge uses as a blueprint to craft the matter of the world. In computer programming parlance, the concepts are called classes, and their instantiations are called objects. The class/object duality is fundamental for modern programming, known as object-oriented programming, and forms the basis for just about all software in use today. Hard to get more useful than that!
So, to answer my friend’s initial question, yes, ancient philosophy can be extremely useful, and entertaining, even when contrary to modern science! Just visit your local theatre and see it in action. Make sure to bring popcorn and a friend.