There's a fun YouTube video going round at the moment about "how Magic Eye pictures were made": https://www.youtube.com/watch?v=uvXY99HysrU

It's a good video but it (by choice) doesn't go into the actual mechanism that makes autostereograms work.

I figured the basics of it out by staring at the images years ago and wrote code to generate them — I'm hazy on when this happened, there is a very real chance I was a literal child working on an Atari STe, so I figured I ought to be able to recreate it now.

I've got a prototype working and made some images — the next steps, I suppose, are to get some nicer patterns into them, put a real interface on it, and/or turn it into a little explainer for the curious.

Here are the scenes not as stereogams. I think the sharp decrease in depth on the right hand side of the last one breaks it slightly. I think very sharp changes are often a problem in these things. certain types of scene just work better, generally I think one big, clear object in the middle works best

image sources:
https://learn.foundry.com/modo/12.2/content/help/pages/rendering/render_outputs_basics.html
https://glampert.com/2014/01-26/visualizing-the-depth-buffer/
https://cgiknowledge.wordpress.com/2013/02/22/z-buffer/

In theory you can layer two of these on top of one another to create a transparency effect. I don't think I've ever seen anyone else do that, but that's partly because it's pretty hard to see. I think the problem is really just that your brain doesn't really see transparency and stereo at the same time very well so the two effects fight with one another somewhat. It's in interesting experiment, but not, alas, a terribly successful one. I think it could just about work in limited circumstances, though. I'm sure there's an art to selecting a good scene, good depth settings, all the rest. This prototype code isn't really good enough for me to really explore that yet.

images:
1. stereogram with transparency effect
2. depth map of "opaque" layer
3. depth map of "transparent" layer
4. stereogram of just the "opaque" layer

image 1 is image 4 with a 50%-opacity version of the stereogram of the "transparent" layer pasted on top

hourglass model from https://skfb.ly/6W9Rz although I had to make my own sand cone because i am bad at blender, you would not believe how hard it was to make this scene

got nicer patterns in now, here's the bear/penguin scene again but with a section of a snowy landscape as the pattern which gives it better vibes

A second Magic Eye nostalgia video has dropped — that must be coincidence, because there's no possible way even Karen managed to do all those ludicrous jigsaws since Clint uploaded his video

https://youtu.be/rHDfqeXBk8U

How hard are the Magic Eye puzzles really?

YouTube

ok, you can play around with this now. still maybe a real explainer to come but the generator is at a point where i'm pretty happy with it

https://github.andrewt.net/stereograms/

Stereogram Creator

Build your own stereograms (and learn how they work)

Arguably I should read some of the actual papers linked in the LGR video to make sure the thing I'm doing is the same thing Magic Eye et al are doing, but like, it must be, right?

I've put together a little write-up of how these work for those as are interested

https://github.andrewt.net/stereograms/wtf/

github.andrewt.net / stereograms / wtf

the trick is to look at a point a few inches behind the image. they're called "aut"-o-stereograms because they stop working if you make direct eye contact
@andrewt Would love an explainer, was absolutely enthralled as a child.
github.andrewt.net / stereograms / wtf

@andrewt Only the last part I'm a bit fuzzy on. The amelioration by starting from the middle. Essentially starting our lookup from the base pattern in the center of the depth map, doing the right side. With that done - what do you base your left side lookup on? The base pattern or the distorted right side of your encoded image?

@cpy oh, you do it from the distorted right hand pattern — you have to sample what's actually there or else people will see the seam between the two halves

There's also some subtle differences between what you actually have to do when going left and going right, but they're not important to understanding how everything works unless you plan to write your own code. (It's just because you kind of have to work out what the answer *would* have been if you were going right, rather than mirroring the process exactly.)

@andrewt Makes sense, thanks!
@andrewt I remember you doing this and favour the STe hypothesis based on the specific kind of hazy the memory is
@mark yeah, i think this would actually have been harder on the PC just because quickbasic wasn't as easy to do graphics on?