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.
Artic Willy

August 31, 2001, 02:16 PM

Hey, that's a long time ago...

Nice house...


August 31, 2001, 02:17 PM

This is so badass! Good work :)

Anders Pistol

August 31, 2001, 02:23 PM

Oaawwhh... a house! :)


August 31, 2001, 02:24 PM

Very cool change of pace. The only thing I find weird is the hammer and wrench one. The wrench is underneath the hammer but took part of the hammers handle out with it. But then hey, just blame it on the evil stare of the aliens one, thats my fav!

Anders Pistol

August 31, 2001, 02:27 PM

This reminds me of the movie "Mal rats", where this guy who are trying to figure one of this images out and all the people behind him see it immediately...
Good work by the way! :)


August 31, 2001, 02:31 PM

Oh man, sweet badass! That house really popped out when I saw it. It was like, I stared at it for like a long time, then all the sudden the house just popped out of the screen. I'm assuming that you can control depths by doing this, right?

I wonder what a game would be like if you played it like this... it would seem like true 3d anyways.


August 31, 2001, 02:35 PM

Nm, I just looked at it again, and I saw varing depths. The only bad thing about making a game like this (real time), is I can just see the player suddenly losing focus while fighting the mother boss. Lol.


August 31, 2001, 02:41 PM

I just can't see those things :(


August 31, 2001, 02:45 PM

Um, TimD? Maybe you are looking at it wrong. I can see the full wrench over the hammer.... Oh well, I went to your website and checked out all your pictures. At first, they took like a minute or two to see them, but by the time I got to the hammer and wrench, it was almost instintaneous.


August 31, 2001, 03:10 PM

funky stuff, i want to try to use a simple fire routine as a depth map, should rock :)

thnx for posting the source, will check it out!


August 31, 2001, 03:16 PM

Super cool! Try moving your mouse around in front of the image after you have it in focus..trippy! I always wanted to know how people made these things.


August 31, 2001, 03:19 PM

What I want to know is can this be done in real-time? I'd like to see a simple spinning cube or some other object, that would be so cool :)

Clemens Hofreither

August 31, 2001, 03:21 PM

Nice work!

I remember Magic Carpet having this sort of stereogram mode... Well, it was unplayable, but still a nice idea...


August 31, 2001, 03:40 PM

Nice! That reminds me of some books full of these stereograms you could buy once :)

Jallen> I don't know if depth images made with patterns can be performed realtime. But you can easily make a spinning cube (or any other 3d scene) with depth, by just rendering two shots of the scene with slightly different x-eye coordinates still looking towards the same target. The left image is showing what the left eye is seeing. The right image shows what the right eye sees. The difference in x eye coordinates is the distance between your eyes (~7cm i think :) This should work, but you'll have to be more cross-eyed than with these patterned images, because you must focus so the left and right images becomes one. Then you can see the depth...

Christian Larsen


August 31, 2001, 03:51 PM

Nice work :D

I bet that was *hell* to debug ;)


August 31, 2001, 04:13 PM

Nice work.:) It took me ages but i saw it in the end! and Magic Carpet did have a stereogram mode, but it was a bit pants.:)


August 31, 2001, 04:18 PM

Thunderbird, if you stare at the intersection of the wrench and the hammer you don't see the wrench a the deepest level and taking a bite out of the hammers handle? I see the bi-fringment around the instersection making the wrench supposed to be on top but it keeps falling away to the back

Anyways, If you think this is cool check out his sandbox demo, I enjoyed that deeply. I admit it, I like little toys that numbingly amuze me.

Gill Bates

August 31, 2001, 04:20 PM

Really nice stuff. My eyes hurt...
Found a game related to this IOTD. A pong clone :)
3d stereogram Pong!


August 31, 2001, 04:21 PM

ARGH! mine eyes!

Good work though I always wondered how they (you know THEM) did that, but didn't have the ambition to look for myself. This IOTD is great!

Simon Veith Reinholt

August 31, 2001, 04:36 PM

Cool.... leaves


August 31, 2001, 04:42 PM

Nice shot, and I liked your ASCII diagrams, too.

Dunno about you guys, but a lot of times, with these magic eye images, I screw up and focus in *front* of the paper, and the depths of all the elements in the 3d scene appear inverted. Weird...


August 31, 2001, 04:46 PM

Neither can I...I feel left out. =(


August 31, 2001, 04:47 PM

I agree,
This is so bad azzz!


August 31, 2001, 05:14 PM

An uncle of a friend had a glass eye. He got sooo frustrated because he couldn't see them. he he


August 31, 2001, 05:38 PM

Only bad thing about stereograms, I can't see them due to blindness in one eye :(. IMAX sucks for me too. Nice change to the IOTD, though.


August 31, 2001, 05:48 PM

I've been following this forum for over 2 years now, and this is easily the most IOTD I have ever seen.


August 31, 2001, 06:02 PM

err, most = best


August 31, 2001, 06:04 PM

I see the green house and some other figures which purpose is not easy 2 guess. Its incredible picture, after a few seconds I was able to see 3D image ! (I mean real 3d !)
Nice, just need some manipulation with eyes.
I havent read your postings, but very likely u were unable to see 3D, despite the above explanations.
Yes, obviously GF3 is easier thing ...


August 31, 2001, 06:47 PM

Magic Carpet 1 had this (also red/blue glasses mode).
Headache inducing, I would say.


August 31, 2001, 07:00 PM

Well after spending about half an hour trying I finally saw the house. This was the first stereogram I could actually see so I'm a happy camper.

For those lost souls out there, try looking cross-eyed and then relaxing your eyes from there. What you're looking for is sort of a "cut-out" image(s) floating above another, with the same pattern. Ofcourse, there are cooler images you can make with say, a sine-wave depth-map hehehe.

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.