Not logged in, Join Here! or Log In Below:  
News Articles Search    

Submitted by Sean Wilson, posted on August 31, 2001

Image Description, by Sean Wilson

I thought I'd send in something a little bit different. I've written a Java applet that combines a depth-map and a pattern to produce stereogram/"magic-eye" images. If you've never heard of them before, they are pictures that hide a 3D image which can been seen by focusing your eyes in a certain way. The algorithm for producing these is actually very simple to implement.

Here is a diagram of light-rays bouncing off a point on a object and into an observer's eyes, who is focused on that point:

      Object point
Left eye     Right eye
The way you see is very complex, but basically both eyes are seeing the same image so your brain can tell how far away the object is based on you focus. Now, imagine placing a piece of paper between yours eyes and the object and colouring in where the light-rays intersect it:

      Object point
---x------x--- Paper
Left eye     Right eye
As long as your eyes are still focusing at the same point (*not* on the paper) your brain is fooled into thinking that the light coming from the two nearby points is actually from one point further away. Also, observe that if the object was to be moved closer, the intersections would be closer together. So, by placing matching pairs of points in an image and focusing differently, you can fool the brain into seeing a 3D image from a 2D one.

If you have trouble seeing stereograms, I'll give you some tips. Make sure your eyes are parallel to the horizontal edge of your monitor and you are positioned in the middle of it, otherwise the matching points won't align properly. Focus behind the screen to start with by going slightly cross-eyed and keep adjusting focus until another image begins to appear. If you don't have this much control on your focus (some people find that difficult), just stick your eyes against the monitor and slowly move your head back without trying to focus on the monitor. There's no reason why anyone can't see them, so just keep trying.

Also, viewing this image at a 1280x1024 resolution, I can see the stereogram easily at sitting distance from my monitor. If the image appears bigger on your screen, you will have to move further away to see it (which most people will find much harder).

If you want to try out some more stereograms and view the source code for producing them, along with some other applets, go to

Image of the Day Gallery


Message Center / Reader Comments: ( To Participate in the Discussion, Join the Community )
Archive Notice: This thread is old and no longer active. It is here for reference purposes. This thread was created on an older version of the flipcode forums, before the site closed in 2005. Please keep that in mind as you view this thread, as many of the topics and opinions may be outdated.

August 31, 2001, 07:22 PM

I'm seriously not able to see those. :P According to my optician, I only use one of my eyes, even though both work fine.. hence no stereograms for me, no sence of depth, etc.

"Wow, cool stereogram!"
"uhh.. yea.. trippy pattern.."


Alberto García-Baquero Vega

August 31, 2001, 08:44 PM

I've never got to see anything.... :-/


August 31, 2001, 08:48 PM

Me too, im begining to wonder how "real" these are :)

Rectilinear Cat

August 31, 2001, 08:59 PM

Nutter: I hope you don't drive often :)


August 31, 2001, 09:05 PM

The easiest way to see the image for is start looking real close to the screen, pull back slowly, and then look left to right really fast (without moving your head of course) for three or four seconds. When you stop moving your eyes the picture will be there plain as day.



August 31, 2001, 09:12 PM

Dammit, I'm gonna see the picture if I have to stand here all damn day.

J Lee

August 31, 2001, 10:12 PM

I see it!... I see it!... :P

It's a little house with a walk-way to the door.

And just when you thought Java was worthless...

...wait...don't flame me...i take it back!

All jokes aside, nice work. :)

Benjamin Zimmer

August 31, 2001, 10:17 PM

Thank You !

I've never seen anything else than the obvious image before...this stereogram ist great.


August 31, 2001, 10:37 PM

Gosh i just cant see it. I never have been able to see the pictures in these type of images. No matter what i do or how long i stare at it, i cant see jack. But nice leaves by the way. :) Still its a cool little program and algo you got going there even if its useless to me since i cant ever see the images. :(



August 31, 2001, 10:59 PM

What I do is I cross my eyes and I start relaxing them until I notice a fluncuation in the drawing. I then concentrate on the fluncutation trying to bring it into focus.


August 31, 2001, 11:22 PM

Omg... now I really feel like an idiot... I still can't see a thing, and I've stared at it like a madman....

Flying Wombat

August 31, 2001, 11:54 PM

That is seriously the best image of the day I have yet seen. Very original, finally a break from all the 3d engine stuff. Totally awesome.

Victor Ho

September 01, 2001, 12:15 AM

Way cool IOTD.....I first two it was some texture synthesis thingy when i saw the thumbnail on the main page.

Time to check out the sources... : )


September 01, 2001, 12:50 AM

This is the first time I have ever actually seen anything in a stereogram - it 'clicked' when I was about 4 inches from my screen, 19', hi-res setting. Just cross your eyes slightly go right up to the screen and move back slowly... wicked ;)

Alex Taylor

September 01, 2001, 01:43 AM

That was the first one of those stupid things I have ever got. Stupid stereograms...


September 01, 2001, 02:27 AM

Hey I like these pics ...
bought a book full of them three years ago, it was soo cool ;-)
Nice idea to write such a programm yourself!

Now I will download it, to check the program itself out.


September 01, 2001, 03:07 AM

I have ALWAYS wanted to know how those work! :D thanks great stuff!


September 01, 2001, 03:13 AM

I've never been able to see stereograms before but I saw this one very quickly. Cool stuff by the way.


September 01, 2001, 03:20 AM

Great work!
This is really the nicest and most unseeable IOTD I haven't ever seen :)

Bah, I still can't see anything..

Wim Libaers

September 01, 2001, 03:36 AM

I've had trouble with it too. But suddenly, it appeared. Moving your head away from the center may ruin it quickly.
Hey, that thing is billboarded ;-)


September 01, 2001, 03:38 AM

hah ... I totaly SUCK at this ;)


September 01, 2001, 04:07 AM

argh i feel like i'm hearing the story of the emperors new clothes all over again. almost everyone can see the picture but i can't. i've tried all kinds of tricks and am confused. either its a hoax or i can't focus it. ah well.. at least its a nice change from the regular iotd!

Boris Reuderink

September 01, 2001, 04:50 AM

I planned to make a realtime renderer that created images like this.. Still have to find the time to inplement this in my engine. Has anyone ideas how to make this using normal 3D hardware? Then it would be really fast.


Alexander Stockinger

September 01, 2001, 04:53 AM

I actually tried the same thing in realtime (no pictures, just noise as pattern though).
It indeed is possible to do in realtime (which really gives some interesting possibilities for 3D engines) but it has one big drawback: You can't have textures.
And moving stereograms are harder to see, especially for people who aren't used to fool their brain... ;)

I really appreciate that I'm not the only one to think of ways to use stereograms...
Great IOTD!



September 01, 2001, 05:22 AM

I imagine lots of people around the world staring like idiots at their monitors and after a hour of mindless gazing at the damn thing they get up and post "wow nice house" or something like that and then go to hunt for some lost souls of their co-workers to convince them to try the same stupid thing and laught just for hell of it
...joke :)
(hey, wait I tried to close my third eye and actually see... Lara Croft.. damn it! :)

David Olsson

September 01, 2001, 06:23 AM

A question:

In most of these images, the object consists of flat surfaces perpendicular to the viewer. Would it be possible to render a "real"
3d scene, where the polygons doesn't have to face the same direction, maybe even with smooth surfaces ?


September 01, 2001, 06:38 AM

This was also the first stereogram which I ever 'saw'. After trying a bit with this one, I also managed to see the others on his site. Really nice. For those that can't see it, maybe this helps. When I look at these I usually focus on the picture. That doesn't work. Then I just 'push' the picture 'back' ... just imagine the picture is further away than it actually is ... and then it just pops out at you.



Rag on a Stick

September 01, 2001, 08:51 AM

In most of these images, the object consists of flat surfaces perpendicular to the viewer. Would it be possible to render a "real"
3d scene, where the polygons doesn't have to face the same direction, maybe even with smooth surfaces ?

To do what I think you are getting at would require you to somehow know the location of the persons head relative to the screen.

Matthew Webster

September 01, 2001, 09:02 AM

I once wrote a BASIC VI program on the Acorn Archimedes to do this.
The algorithm is easy if anyone wants the listing. Once you have the basics, it's dead easy to mould to do lots of stuff.

Sean Wilson

September 01, 2001, 10:31 AM

Thanks for all the positive comments everybody, I really appreciate them and glad you like my work.

The reason some people might see these images inverted is because you can also view them in a cross-eyed way which makes the matching pixels seem at the 'opposite' depth. This is why some people have trouble with the "hammer and wrench" one because the depths must be correct for it to look right. If you are doing this, here is what is going on:

Object point
---x------x--- Paper
Left eye Right eye

If you find it really hard not to do it this way, download the stereogram applet from my site and edit the html pages to add an extra parameter that inverts the depth:

<applet code = "StereogramApplet.class" archive = "stereogramapplet.jar" width = "800" height = "600">
<param name = "DepthImage" value = "depthmaps/house.jpg">
<param name = "PatternImage" value = "patterns/ivy.jpg">
<param name = "SeperationRange" value = "-20">

Sorry for all the people that can't see it, there's nothing more I can say than just keep trying. Unless you have problems with depth-perception, there's no reason why you can't. This means if you have a dominant eye or you only have one that works you won't be able to see them. Let's call it a hardware problem :)

CGI Joe: It was a nightmare to get working. Even though the algorithm is very simple, to check that it works I had to keep staring at the screen even if it there was nothing to see. I then had to find the best pixel separation ranges that were easiest to focus on and by that time I must have looked like I was in a trance. However, I've got really good focusing skills now :)

Jallen: There's no reason they cannot be done in real-time, there's some animated stereograms kicking around the web somewhere. I originally wrote this in C last year and the time it took to generate images in that was tiny, although I haven't tried to optimise my applet.

Dirty: You can make all sorts of stereogram images, I just haven't had time to make better ones. For those who don't know, the depths-maps are the "webdings" font letters coloured in :) The depth-maps are just grey-scale images, so you can try to draw your own if you download the applet. I suppose if you rendered a 3d image with just one light where the camera is you could generate nice depth-maps.

David Olsson: If you try looking on the web, there are stereograms that have a more 3D look than my depth-maps.


Sean Wilson

This thread contains 71 messages.
First Previous ( To view more messages, select a page: 0 1 2 ... out of 2) Next Last
Hosting by Solid Eight Studios, maker of PhotoTangler Collage Maker.