## Monday, January 12, 2009 ... //

### Stereograms and dinograms

Dmitry Podolsky chose an autostereogram, one of the types of stereograms, as a symbol of holography in quantum gravity. It is a pretty good choice, as I will argue later. He has also reminded me of some fun we had back in 1995 in Prague.

Two very smart Slovak classmates of mine (we became the last freshmen who joined the college as federal, Czechoslovak students) saw an interesting exhibition somewhere in Prague with some crazy pictures that looked completely two-dimensional and chaotic, but if one looked at them properly, they became completely three-dimensional.

You may also look for images of stereograms or articles explaining holovision or volumetric display.

Reconstructing the secret know-how

They described their "stunning" perceptions so well that even though they didn't quite know how the pictures worked and I hadn't seen them, it was possible for me to reconstruct the algorithm and write a working model in Turbo Pascal, together with a pedagogical explanation in the Pictures of Yellow Roses (a now-defunct math-phys student journal written in Czech); see the automatic translation to English.

The article included (and still includes) a working program in Turbo Pascal and I will describe most of the article below.

Although I can run Turbo Pascal programs within DOSbox 0.72 on Windows Vista, I decided to refresh the programming languages a bit and translate the Pascal program into Mathematica 7. It was a seemingly straightforward exercise but when I was converting some functions and procedures to more natural expressions in Mathematica, I confused "Min" and "Max" several times which made the program generate rubbish.

Moreover, the command setting a range of a field equal to an {R,G,B} triple works - and sets the same color for many points at the same moment - except in the case when the range contains three entries, in which case the {R,G,B} entries are inserted separately in the array and everything is screwed.

I don't want to waste your time by detailed explanations how I just wasted an hour by fixing these two stupid bugs that arguably appeared because Mathematica is sometimes too tolerant: it always prefers to do "something" rather than to stop with an error message (complaining e.g. about incompatible types of variables etc.). The disadvantage of this tolerance is that sometimes it's not quite clear what "something" will be and some errors in your code can be hiding for quite some time. :-)

Instead, here is the result:

It is absolutely essential for you to (SHIFT) click the image and open a full-size picture (1000 times 750 pixels, in this case). It looks quasi-periodic in the x-direction. You should look at it in such a way that your left eye is observing an object "N" while your right eye is looking at the object "N+1", an approximate copy of "N" located one (approximate) period on the right side from N.

In other words, your eyes should be directed in a more parallel direction than normally, attempting to focus on something that is further from you than the LCD panel. You may need to look at a real object above the screen that is further from you than the screen, or to get tired a little bit to cross your eyes into the squinting regime and to observe the dinogram properly. But if you succeed, you will see a three-dimensional shape, and you may describe how it looks like in the fast comments.

How does it work?

Now I will tell you the secret which is the rough content of the article in the Pictures of Yellow Roses. The parody of a fairy-tale above the green dinogram will be omitted because non-Czech readers couldn't quite understand its point and the fairy-tale was arguably stupid to start with. ;-)

OK, fine, the fairy-tale says that the grandma/wolf/dinosaur is corssing his or her eyes in order to see the little red riding hood (the girl with the red cap) better, and he or she has sharp teeth because he or she uses Colgate the toothpaste. I don't really know why but I had to find this story funny at that time! :-)

Here is the key pedagogical illustration:

Imagine that you want to create a dinogram (this term of mine was a Czech acronym but let me suppress these details) of the curved three-dimensional surface behind the LCD screen (further from your eyes than the screen) that contains points A1,A2,A3,A4. You need to print a nice quasi-periodic wallpaper on this sheet in such a way that if you project it on the screen, it is possible for your two eyes to look at it in the "wrong way" and interpret the flat picture as a wallpaper on a three-dimensional shape.

This was a terribly confusing paragraph, wasn't it? What do I mean? Let me tell you how to construct the picture.

Imagine that you want a red dot to be attached to the point A1 on the three-dimensional space. That means that you connect the point A1 with your left eye and the intersection of this straight line with the LCD screen, called B1, must be painted red, too.

But if your second, right eye is looking at the point A1 behind the screen (on the three-dimensional shape), the point A1 seems to be located at a different point of your monitor than B1, namely B2. Clearly, this point B2 must be red, too. If your left eye is looking at B1 while your right eye is observing B2, you may think that you are actually observing a point A1 behind the LCD panel.

However, the red point at B2 is seen by your left eye, too. Instead of saying that it is a mistake, you decide that when your left eye looks at B2 on the screen, it is actually observing another point behind the screen, which must clearly be A2, the intersection of the three-dimensional shape with the line connecting your left eye and B2. So this point must be red, too.

Now, if the right eye is observing A2 in space, it will appear as another point on the screen, called B3. This point must be red, too.

And you continue in the obvious way (B1, A1, B2, A2, B3, A3, B4, A4, ...), creating a quasi-periodic sequence of red points on the screen. Whenever the curved shape is closer to the plane of the screen, the periodicity becomes shorter, while it grows longer when the three-dimensional shape it very far from the monitor. In holography of quantum gravity, the additional, holographic dimension is encoded in the "scale" in a rather similar way: this comment was remarkably absent in my 1995 article about the stereograms even though 1995 looked like the ideal time to write about holography!

(The previous long sentence is the only justification of Dmitry's decision to use the stereograms as a symbol of holography in quantum gravity that you can find in this article.)

The algorithm must also paint other points between A1 and A2 - and similarly between A2 and A3 and so forth - by many other colors that are extrapolated to the rest of the picture by the same algorithm. Once your line is complete, you repeat the same algorithm for each value of "y", the vertical dimension of the picture, being careful that the colorful spots are not too tiny. At the very end, you end up with a dinogram.

Finally, here is the elementary
Mathematica 7 dinogram notebook
that drew the picture above. Spoilers (the function h(x,y) encoding the shape) are included in the notebook! You may try to draw the dinogram of more interesting functions h(x,y) and/or improve the algorithm in other ways.

#### snail feedback (4) :

reader Robert said...

Here is one I produced for the Strings '99 poster:

http://strings99.aei.mpg.de/strings99.jpg

reader John Archer said...

Lubos,

What the fuck's wrong with your fast comment facility?

Right. For the 3rd time....................

Depending on how you focus your eyes, you can see one of two images. In this example, the pyramid's summit appears either further away from you than its base or nearer to you than its base. That is, the pyramid can look either concave or convex.

In the former case, you are focusing at a point intermediate between your eyes and the screen and about (very approximately) 20% of the way out from the screen towards your eyes.

In the latter case, your point of focus is behind the screen. The approximate ratio (20%) is about the same.

reader Petr Panuška said...

Hello Lumo, it's been some time since the last time we met (virtually obviously). Not being mentioned in http://zpravy.idnes.cz/prestizni-anketa-nejlepsi-evropsky-blog-psal-loni-fyzik-z-ceska-p8q-/media.asp?c=A090114_110150_media_jw, I wouldn't run into your blog. Congratulation to your victory!
PePan
P.S. BTW, the problem you described as 'too tolerant Mathematica' is called 'implicit type casting'. There's been already many arguments among developers about the (dis)advantages of this 'feature'...

reader Luboš Motl said...

Hi PePan, great to e-see you after all those years, and thanks for your pleasing words! Well, implicit type casting sounds scientific. ;-) Best wishes, Lubos

(function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){ (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o), m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m) })(window,document,'script','//www.google-analytics.com/analytics.js','ga'); ga('create', 'UA-1828728-1', 'auto'); ga('send', 'pageview');