More donut madness

This draft, created on May 27, 2015, only had a single link:

And the problem with a link that was stored over 7 years ago? It’s no longer available, and it also wasn’t cached by the Wayback Machine. But, as luck would have it, I saved a copy locally, so I can provide it to you:

It was a paper written by Ali Barimani, titled “A review of methods of creation of torus and torus-like objects”, published in 2007 apparently. It seems to be a somewhat obscure paper, as I haven’t been able to dig it up via Google Scholar or other academic search sites. All I could find was this link, which includes the paper. It appears to be some random archive site, which has apparently archived the publication that this paper was published in, apparently from the original ‘’ domain, which is now gone. Anyway, let’s look at what we have here.

The paper gives some background information on certain properties of the torus, or donut, and describes a few ways to generate the geometry for 3d-rendering a textured, shaded torus.

I originally saved the link to this paper, because it was a good starting point for talking about why I like to use a torus for my retro rendering projects. And that has to do with these properties of the torus.

For starters, a torus is not a convex object. A convex object has a number of properties, which make it easy to render. Most notably, convexity means that no matter from which orientation you look at the object, there will only be one surface of the object facing you, and one surface facing away from you. And the surface facing you will be closer to you than the surface facing away from you. In other words, all backfaces are behind all frontfaces by definition. This means that when you render a solid object, all backfaces are occluded by frontfaces, and as such, they never have to be drawn. This means that you can draw a convex object correctly, by just culling all backfaces. No additional depth sorting is required.

Since a torus is not convex, backface culling alone is not enough. From certain orientations there can be frontfaces behind other frontfaces. Which means the frontfaces have to be sorted on depth in some way. Which is one reason why I choose the donut for rendering: it shows off that my renderer can perform efficient and correct depth-sorting for inconvex objects.

Another interesting property is that a perfect torus has a perfectly smooth, rounded surface. This makes it an interesting target for more advanced types of shading such as Gouraud or Blinn-Phong smooth-shading, or environment-mapping. Trying to make a low-poly torus look smoother than it actually is, based on its geometry. It especially is a nice case for specular highlights. The “chrome donut” is like a Hello World for a decent software-renderer targeting an early 90s machine such as an (accelerated) Amiga or 486/Pentium PC. It’s also an interesting case for early 3D accelerators.

This entry was posted in Oldskool/retro programming, Software development and tagged , , , , , , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s