The Mary Queen of Scots Channel Anamorphosis: A 3D Simulation
May 17, 2025
Roscoe, N.Y.
I’ve been going down some odd rabbit holes recently while researching my free online book-in-progress The Lost Art of Logarithms. Although the book is mostly focused on the history, use, meaning, and importance of logarithms, I believe that even histories of science and mathematics profit by being placed within political, cultural, social, and religious contexts.
This is particularly true of John Napier’s invention of logarithms. It seems that Napier began thinking about logarithmic concepts while working on his first book — a mathematical analysis of the Book of Revelation published in 1593. Although Napier had been working on this book for some years, it was given special urgency by the attempted invasion of England by the Spanish Armada in 1588, which had as its goal the overthrow of Queen Elizabeth. Spain decided to launch this attack by the shift in European geopolitics following the 1587 execution of Mary Queen of Scots.
I have therefore been deep into research into the Protestant Reformation in general, the English and Scottish Reformations in particular, and the major players within these movements, including the Tudors and the Stuarts. While reading about Mary Queen of Scots, I came upon a reference to a channel anamorphosis painting (also known as a turning picture or a tabula scalata) on display in the National Portrait Gallery in Edinburgh, so of course I immediately thought about creating a 3D simulation.
Here’s a short (15-second) YouTube video of a progressive view of the painting as the viewer moves from left to right:
The image shifts from a woman’s face to a skull.
The National Galleries website labels this painting as Anamorphosis, called Mary, Queen of Scots, the word “called” suggesting that it might not actually be her. The artist is unknown but the date of composition is given as 1580, which is several years before Mary was executed, so the transformation into a skull seems a little premature.
The two images are painted on a panel built from a row of prisms, which I’ve mimicked here with 3D graphics using WebGL:
You can drag this image with your mouse or your finger to view the prismed panel from different directions. I found an article entitled "The Mathematics of the Channel Anamorphosis" that concluded that the prisms in the Mary Queen of Scots painting used angles of 45°, 45°, and 90°, and that’s how I constructed the panel.
The National Galleries website allows downloading and using two images of the painting with a “personal-use license agreement” that permits its use “on websites that are primarily information led, research oriented and non-commercial.” I will be using these images in an educational manner in this blog entry to demonstrate how they can be turned into a 3D simulation.
The two images on the National Galleries website show the painting from two different perspectives:


Alas, each of these two perspectives shows about 2/3rd of one image and about 1/3rd of the other.
From each of these bitmaps I had to extract images that were mostly one and not the other. I measured pixel positions manually and then wrote a little WPF program in C# to construct better separated images:


This is far from perfect, but I didn’t expect something immaculate.
The next step was to merge the two images by alterating the strips:
This looks peculiar, of course, but now it’s ready to be overlaid on the 3D prism panel. And here’s the result:
Swipe the image with your mouse (with button pressed) or finger from right to left to turn the face into a skull.
All the JavaScript source code for rendering the 3D image is attached to this HTML file. I apologize for the plethora of files; they are part of an infrastructure to allow me to use WebGL in a reasonbly straightforward manner.