← Iris

Mode Text
Pattern width 100 px
Depth levels 8
Resolution 800 × 600
Relax your eyes and look "through" the image to see the hidden shape
Pattern width 100
Depth strength 8
Dot size 2

How autostereograms work

An autostereogram exploits binocular disparity — the slight difference between what your left and right eyes see. Normally, your brain uses this difference to judge depth. A random-dot stereogram contains a repeating horizontal pattern with subtle shifts: where the hidden surface is “closer,” the pattern repeats at a slightly shorter interval, and where it’s “farther,” the interval is wider. When you diverge your eyes so that each eye locks onto adjacent repetitions of the pattern, your visual cortex interprets the disparity as depth, and a 3D shape appears to float above or below the background.

The invention of Magic Eye

The concept originated with Bela Julesz, who in 1959 created random-dot stereograms (viewed with a stereoscope) to prove that depth perception could arise from disparity alone, without monocular cues like shading or perspective. Christopher Tyler and Maureen Clarke extended this in 1979 to create the first single-image random-dot stereogram (SIRDS), eliminating the need for a stereoscope. The technique became a cultural phenomenon in the 1990s through the Magic Eye book series, which sold millions of copies worldwide.

Parallel vs. cross-eyed viewing

There are two ways to see a stereogram. In parallel viewing (also called “wall-eyed”), you relax your eyes as if looking through the image at something far behind it — each eye sees a different repetition of the pattern, and the hidden shape appears to float behind the surface. In cross-eyed viewing, you focus in front of the image, crossing your eyes slightly — this inverts the depth, making raised areas appear sunken and vice versa. This generator is designed for parallel viewing: the shape should appear to pop out of the background.

The algorithm

The generator works column by column from left to right. It first creates a random strip of dots on the left edge, one pattern-width wide. For each subsequent column, it copies the dot from one pattern-width to the left, but shifts it by an amount proportional to the depth at that pixel. Where depth is zero (background), the pattern repeats exactly; where depth is positive (foreground), the repetition is slightly compressed, creating the disparity that your brain reads as a closer surface. The “cheat” mode overlays the depth map so you can see exactly what shape is hidden before you try to view it.