Have you walked through a mall lately? These days, as you wander past most of
the poster shops, there will be a large group of people staring at the same
poster with surprisingly weird expressions on their faces. Some will be in the
initial stages of denial or rejection---they will be concentrating, some slowly
rocking their heads backwards and forwards, searching for an image that they
have never seen before. Others will be grinning from ear to ear, pointing at the
poster, chuckling with their friends that a member of their group hasn't seem
them yet. "Come on Bill, come on!", they cry and as Bill gets increasingly more
frustrated he concentrates harder and harder, until finally (if he's lucky) he
sees a true 3D image, without the need for special glasses or equipment.
These pictures are known as Single Image Random Dot Stereograms (SIRDS), or
Single Image Stereograms (SIS) depending on whether the picture contains random
dots as a base for the 3D effect, or a repetitive pattern. Unfortunately, each
commercial company has labelled them differently. Shop owners generally don't
know what you mean, unless you say "Hollusion" or one of the many other specific
names.
Stereogram Mechanism
-- Cristian Alb
(luminita@poincare.mathappl.polymtl.ca)
Disclaimer:
All
the opinions and ideas presented in this [article] are mine and are the result
of my own reflections on the subject.
Purpose:
This document
wants to provide an easy understanding of the mechanism of 3-D perception
related to stereograms. Due to the fact that it is the result of genuine
thinking, I hope that this document provides a more intuitive approach to the
subject.
What is a stereogram ?
In this document I refer to stereogram (though, single image stereogram would
be more correct) as being something like the image that follows:
If you stare at this image by trying to focus on something behind the
image, you will be able to see, after some-time, a 3-D scene with the letters F
Y I detaching from the background. (If you read this document on a monitor it is
easier to focus on your image reflected on the screen in order to get the 3-D
illusion. If you read this document on paper, try to put a glass in front of it
and do the same thing.)
To understand the mechanism which allows you to get this peculiar effect, we
should take a look at the process of vision.
The feeling of "depth" that you get by looking at a statue instead of looking
at a photo of the same statue, is due to the fact that the human body has
two eyes.
In the above example with the statue, we need just one eye to get the general
shape of the statue. A humble photo does the same. It is the second eye that
provides some "extra" information. This extra information is the "depth" of the
various parts of the statue. In fact a "photo" gives just a bi-dimensional (x,y)
representation, to get the third dimension (z) you need some "extra".
y
| |---------
| z | Photo |
| / | |
| / ---------|
|/_______ x
By having two pictures of the same object, taken by two different
positions, which is the case of the human eyes, you can get the "z" coordinate
to that object. It is a simple geometrical question.
In fig.1 we assume that there are 2 objects, X and Y which are at the same
height (y) and different depths (z) and positions (x)
|--------------------------------------------------|
| Fig.1 |
| z |
| y | |
| Y \ | |
| \|_____x |
| |
| |
| |
| |
| |
| X ^ |
| | |
| | |
| | |
| (o) (o) |
| watching |
| left-eye right-eye direction |
| (depth) |
|--------------------------------------------------|
In fig.2 are shown the kind of "pictures" that each eye gets:
(fig.2L -left eye, fig.2R -right eye; the '+' marks the center of each
picture)
|--------------------------| |-------------------------|
| Fig.2L | | Fig.2R |
| | | |
| | | |
| | | |
| X Y + | | X Y + |
| | | |
| | | |
| | | |
| | | |
|--------------------------| |-------------------------|
As you can notice the 'X' shifts more than the 'Y' from one picture to
another. This is an indication that the X object is 'closer' than Y.
- shift.X = d.hrz.right ( X, '+') - d.hrz.left ( X, '+')
- shift.Y = d.hrz.right ( Y, '+') - d.hrz.left ( Y, '+')
where "dx.hrz.hhh ( A, '+')" means distance (on the horizontal axis) in the
hhh picture from object A to origin/center.
Furthermore, with good approximation we can say that any objects with the
same 'shift' are at the same "depth" (z)
In the same way, the eyes forward to the brain two slightly different
pictures. It is the brain that must "compute" a 3-D representation of the scene.
The difficulty is to know which pairs must be associated to "compute" the
z-coordinate. In the example above it's easy to assume that the 'X' from each
picture is associated to one 'X' object. The same goes for the two 'Y'. But the
images that the brain gets to compute, can be quite complicated. What if there
are more X-s and Y-s in each picture ? How does the brain establish the
"couples" for which to calculate the shift/depth ? A clue is that each pair must
be on the same height (y). Which means that the brain should not try to
associate spots, patterns that are located at different heights. But that is not
enough !
The 'brain' can make mistakes in this process of designation of pairs! It is
that which make possible the 3-D feeling that we get from stereograms.
The simplest stereogram that we can get is something like-this:
________________________________________________________
| * * * * * * |
| * * * * * * |
| * * * * * * |
| * * * * * * |
| * * * * * * |
| * * * * * * |
| * * * * * * |
| * * * * * * |
| * * * * * * |
| * * * * * * |
| * * * * * * |
| * * * * * * |
| * * * * * * |
| * * * * * * |
| * * * * * * |
| * * * * * * |
| * * * * * * |
| * * * * * * |
|------------------------------------------------------|
Col:1 2 3 4 5 6
Using the same procedure as in the beginning of this document you should
be able to see the same '*' columns but "somewhere behind" this document.
In fig.3 (Left/Right) I have represented the kind of pictures that the eyes
forward to the brain when looking at the preceding stereogram. (notice '+', the
center)
|----------------------------||--------------------------|
| : : : : :Fig.3L||: : : : Fig.3R:|
| : : : : : : ||: : : : : :|
| : : : : : : ||: : : : : :|
| : : : : : : ||: : : : : :|
| : : +: : : : ||: : : : + :|
| : : : : : : ||: : : : : :|
| : : : : : : ||: : : : : :|
| : : : : : : ||: : : : : :|
| : : : : : : ||: : : : : :|
|----------------------------||--------------------------|
column:
1L 2L 3L 4L 5L 6L 1R 2R 3R 4R 5R 6R
Normally the brain will associate the columns in the following way:
- 1L-1R, 2L-2R, 3L-3R, 4L-4R, 5L-5R, 6L-6R
but it can happen that the brain does the following association:
- 1L-2R, 2L-3R, 3L-4R, 4L-5R, 5L-6R, ?-1R, 6L-?
Remember: All columns look alike !
Of course it is possible that the brain makes other associations of these
kinds:
- 1L-3R, 2L-4R, 3L-5R,... or 2L-1R, 3L-2R, 4L-3R,... etc.
but in
these cases the resulting 3-D representations makes no sense, or are very little
alike.
It can be noticed that by choosing a diferent association of columns the
"shift" between the images of the objects changes. As a result the "depth" of
the perceived objects changes. In the association 1L-2R, 2L-3R,... the shift is
reduced -> the "depth" increases -> the columns seem somewhere behind.
Is it possible to determine exactly the power of the brain in matching
complicated images ? I thought, some time ago, what would happen if we put
someone in front of a large panel situated at a convenient distance (so that the
eyes are relaxed) and the panel is full of randomly disposed spots. The spots
should be all alike and in very great number, very small but big enough to not
became a uniform gray. The brain should be overwhelmed by the great number of
matches that it must try. What will happen ? The person will get dizzy ? get a
headache ? Or will the person be forced to see just a gray fog ?
Most Stereogram pictures are usually generated so that if you look at
(converge your eyes on) a position twice as far away as the picture, and focus
on the picture, generally after a few minutes you see a surprising 3D image!
Most people find this extremely difficult for the first time. You have to
focus on a point which is different from where you are looking. This is known as
"de-coupling" your vision process. Instinctively people focus at the same point
they are looking at, and this is the main obstacle in seeing images of this
type.
This is why most posters come with a reflective surface such as glass or
plastic covering them---if you try to look at your reflection you will be
looking at a point twice as far away as the actual poster. It has been noted by
almost everyone that while this sometimes helps beginners see the 3D effect for
the first (and perhaps even the first few) times, experienced viewers to not
need any help like this, and indeed the reflection is usually very distracting
and decreases the quality of the 3D effect.
There are many ways to teach this de-coupling to either yourself or to
others, including (in almost no particular order):
NOTE: It is generally easier to see Stereograms under bright light. I have
been told this is because you eye relies less on focus under harsh conditions.
Another point, to see stereo images, you need to have "passable" use of both
eyes. If you wear glasses try with and without them on. Some short-sighted
people can see them easier without their glasses on (if they get closer to the
picture).
The pull-back
Hold the picture (or move your face) so your nose is touching the picture.
Most people than can not possibly focus with something this close to their eyes,
and they will be content with their inability to focus. With the picture up
close, pretend that you are looking straight ahead, right through it. Now slowly
pull the picture (or your face) away while keeping your eyes pointed straight
ahead. If you do this slow enough, an image usually appears when the picture is
at the correct distance.
The reflection
As mentioned above, with a reflective surface it is sometimes a lot easier to
converge your eyes in the correct position. You simply focus on your nose or
some central reflection in the picture, and wait until you focus on the image.
The drunk-eyes
This method is used to describe the feeling of the process of deconverging
your eyes. It is very much like being drunk or having "staring-eyes". Your eyes
don't look at the object, but rather through it. This state is common to some in
the morning before the coffee caffine fix.
The wall, or the finger
Hold the picture so that it is half between you and a wall. Look *over* the
top of the picture towards the wall, and focus on something such as a picture
hook or mark. While keeping this "gaze" either slowly lift the picture or lower
your eyes while keeping them converged on the wall.
A similar approach (but for cross-eyed viewing) is to stand arm's length away
from the picture and put your finger on the picture. While slowly pulling your
finger towards your face, keep looking at your finger, you will notice the
picture becoming blurry, and at an intermediate position you will (eventually)
see the 3D image.
The see-through
If it is possible, photocopy the picture onto a transparency. Then focus
through the transparency onto something twice as far away. This is similar to
(The wall, or the finger) above except now you don't need to change the position
of your gaze.
Cheating...
To cheat, photocopy the image onto two transparencies, then overlay them and
carefully shift them horizontally so they are about an inch or two out of
alignment. Somewhere around this position you will see a rendition of the image.
Obviously in 2D not 3D, but you will at last finally believe there is "somethere
in there."
For those who do not have a local SIRDS distributor (i.e., the poster cart at
the mall), here are a few companies you may be able to order from.
------------- Infix Technologies -------------
$20 Earth (mercator projection of the Earth's altitudes)
$20 Salt Lake LDS
Temple Centennial
$20 Beethoven (300 DPI! Very smooth.)
These prints are 18x24 inches. Retail price for the 18x24 inch prints is $20
plus $3 s/h. Utah residents add 6.25% sales tax. Wholesale and distributor
discounts are available. Quotes for custom work are also available. Cost and
minimum order varies, based on content.
PO Box 381
Orem, UT 84057-0381,USA
Ph: (801) 221-9233
email: John
M. Olsen (jolsen@nyx.cs.du.edu)
------------- Inner Dynamics, Inc. -------------
(Distributors)
Privileged Traveler
4914 Brook Road
Lancaster, OH
43130, USA
(614) 756-7406
Glow in the Dark Poster Series - $22 (size: 18" X 24")
- "Knight Vision" - suspended chess board with chess pieces above the board
in daylight viewing; also an area in the center that has a Knight chess piece;
random dot pattern glows and is viewable in the dark!!
Premium
Color Series - $16 (size: 18" X 24")
- "Gecko" - twin Gecko lizards
- "I Think Therefore I Am" - well known quote surrounded by stunning visuals
- "SoulMate" - hearts, spirals, and other symbols, for that special person
- "The Mighty Unicorn" - unicorn, mystical castle, wizard, and flying dragon
- "Excalibur" - legendary sword in the stone, castle, knights, etc.
- "Where's Wilbur?" - can you find him in the forest?
Optimum
Series - $15 (size: 24" X 36") (black and white)
- "Beyond Reality" - hearts, spirals, other cool shapes; extremely detailed
- "20/20 Third Sight" - an eye chart done in 3D
- "Illusions" - a labyrinth, try to find your way out!
- "Meditation" - contains an ancient mandala, a real stress buster
- "DreamWeaver" - unusual geometric shapes, `helps' induce lucid dreaming
and dream remembrance
- "Icons" - the five symbols of life; very stunning visuals
- "Rainbows" - see color on a black and white poster (Not a 3D poster)
Retail prices (USA) stated above plus $3 S&H (USA) - call for overseas
S&H. Ohio residents add 5.5% sales tax.
------------- Altered States -------------
92 Turnmill St,
Farringdon,
London, EC1, U.K.
+44 (0)71 490
2342
Paul Dale (P.A.Dale@bath.ac.uk)
tel: +44 (0)225 826 215
------------- N.E. Thing Enterprises -------------
Send a catolog request to:
N.E. Thing Enterprises
19C Crosby
Drive
Bedford, MA 01730, USA.
-- info from: Neal T. Leverenz
(at802@yfn.ysu.edu)
Books
"Stereogram"
(c) 1994, Cadence Books, P.O. Box 77010, San
Francisco, CA 94107, USA.
A newly edited version of CG STEREOGRAM and CG
STEREOGRAM 2,
published by Shogakukan Inc. In Tokyo, Japan"
ISBN
0-929279-85-9
US$ 12.95
I liked it. Much better in my opinion than the
other Stereogram book I've seen ("Magic Eye"). This one includes much textual
information, including the origins of stereograms, how to see them, precursors
such as stereo pairs, and an article by Christopher W. Tyler, who invented the
SIRDS. Best of all were the stereograms themselves. There are roughly 50 SIRDS,
most of them full page (the book is softcover and about 8" square). The ones
I've managed to see so far have been quite good, and also included are some of
the very first ones. In the history department there are stereo pairs, stereo
photographs, and even some stereo-pair paintings by Salvador Dali. All of the
stereograms indicate whether they require wall-eyed or cross-eyed viewing (or
either). Most are true 3d designs, not the "cutout" variety. The book is 93
pages and most of the plates are full-color. Well worth the money in my opinion.
-- Michael Moncur (mgm@xmission.com)
I highly recommend
the new book "Stereogram" by Cadence books, ISBN #0-929279-85-9 (in Canada). It
is a fantastic book that includes hundreds of stereograms, stereo pictures,
RDS's, lots of very interesting writeups on the history of stereograms, a cool
section on Salvador Dali (stereo pair aritst). The concentration of course is on
the pictures. The book is just under 100 pages. Much better value then Magic
Eye. It's even got some cool cross-eyed only viewing stereograms, which I'd
never seen before this (I'd always used the other technique). If you have *any*
interest in stereograms, buy this book, you won't regret it!! At $17 Cdn, it's
not that much either, considering the amount of time you'll spend revelling in
the 3d inside.
-- Ian Sewell (3386005@queensu.ca)
"Principles of Cyclopean Perception"
(c) 1972 by Bela Julesz,
MIT
press. Considered by most as the original work oPn Random Dot Stereograms:
-- Charles Eicher (CEicher@Halcyon.com)
"Magic Eye: A New Way of Looking at the World"
(c) 1993 by N.E. Thing
Enterprises.
Andrews and McMeel, A Universal Press Syndicate
Company
Kansas City, USA. ISBN: 0-8362-7006-1
First Printing, September
1993 ... Fifth Printing, January 1994
Introduction contains a history of
the technique and phenomena. Viewing Techniques are explained. 25 pages of
full-color STARE-E-O images. (Plus images inside the front and back covers.)
"Answers" included. 32 pages, hardcover, 8.75x11.5 inches, horizontal format,
with slipcover.
US$12.95 ($16.95/Canada)
"Magic Eye II: Three Dimension Trip Vision"
(c) 1992 by N.E. Thing
Enterprises/Tenyo Co., Ltd.
Korean Translation (c) 1993 by Chungrim
Publishing Co.
All the text is in Korean, so I can't read it. But it has
some pretty cool pictures. They are all SIRxS where x is various
patterns/pictures. I paid US$20 for it. Interestingly, this title doesn't seem
to be mentioned in my N.E. Thing catalog.
-- Mark Hudson
(M_Hudson@delphi.com)
They've taken the technique a step further by
applying the pseudo-random patterns as noise superimposed over another image.
You look at the pages of this book and see one image, then cross your eyes and
concentrate on the replicated patterns in the background noise and see the
second image. It's kinda cute.
-- Robert Reed
"Das magische Auge" (German version of "Magic Eye")
(c) 1994, arsEdition,
Munich
ISBN 3-7607-8297-3
DM 29,- (seen at a store for this price)
"Stereo Computer Graphics and Other True 3D Technologies"
(c) 1993, David
F. McAllister, Ed.
Princeton University Press
ISBN 0-691-08741-5
US$75.00
It has several nice color plates, with stereo "triads". The
triads consist of a left, a right, then another left image. Use the left pair
for viewing walleyed, or the right pair for viewing crosseyed.
--
Mike Weiblen (mew@digex.net)
"Random Dot Stereograms"
(c) 1993, Kinsman Physics, P.O. Box 22682,
Rochester, NY 14692-2682, USA.
An excellent source of information (sample
RDS and source code)
-- Eric Thompson
(E.Thompson@ncl.ac.uk)
ISBN 0-9630142-1-8
US$ 13.95
"Human Stereopsis. A psychological Analysis"
(c) 1976, W.L. Gulick and
R.B. Lawson,
Oxford University Press.
Papers
B. Julesz and J.E. Miller, (1962) "Automatic stereoscopic
presentation of functions of two variables" Bell System Technical Journal, 41:
663-676; March.
R.I. Land and I.E. Sutherland, (1969) "Realtime, color, stereo, computer
displays" Applied Optics, 8(3): 721-723; March
D. Marr and T. Poggio, (1976) "Cooperative computation of stereo displarity"
Science, 194: 283-287; October 15
D. Marr and T. Poggio, (1979) "A computational theory of human stereo vision"
Proceedings Royal Society of London, B204: 304-328 Science, 194: 283-287;
October 15
G.S. Slinker and R.P. Burton, (1992) Journal of Imaging Science and
Technology, 36(3): 260-267; May/June
D. G. Stork and C. Rocca, (1989) "Software for generating auto-random-dot
stereograms", Behavior Research Methods, Instruments, and Computers 21(5):
525-534.
H.W. Thimbleby and C. Neesham, (1993) "How to play tricks with dots" New
Scientist, 140(1894): 26-29; October 9
C.W. Tyler and M.B. Clarke, (1990) "The Autostereogram" SPIE Stereoscopic
Displays and Applications 1258: 182-196
C. Wheatstone, (1838) "Contributions to the physiology of vision. Park I. On
some remarkable, and hitherto unobserved, phenomena of binocular vision" Royal
Society of London Philosophical Transactions 128: 371-394
C. Wheatstone, (1838) "Contributions to the physiology of vision. Park II. On
some remarkable, and hitherto unobserved, phenomena of binocular vision
(continued)" The London, Edinburgh, and Dublin Philisophical Magazine and
Journal of Science, series 4, 3: 504-523
Usually people post requests for information to newsgroups such as
comp.graphics...unfortunately these people sometimes get flamed, get told it is
*impossible* to draw them...if this has happened to you read alt.3d , viva la difference.
To calculate the relationship between the pixels is the *only* complicated
stage. We use an array called 'same[]' which simply points to a pixel (in the
same scan line) that has the same value.
The second "for x" loop does this. At each position in the object, calculate
the dot separation, calculate where the left and right line of sight will
intersect the image, and shuffle the array so there is a one to one link.
After we have this 'same[]' array we simply iterate over the array, picking a
colour and propagating it's colour across the bitmap. And then the process is
finished, the result: a Single Image Random Dot Stereogram.
The first step in the generation of a SIS (Single Image Stereogram) is to
transform the scene you want to render into a depth field. One
interesting method is to scan your screen line by line and intersect objects
with one ray (say using a ray-tracing assimilated method). But you can also
slice your scene if it appears more convenient. A proper rescaling of
your depth may also be useful when objects extend to far from (or to close to)
the eyes, for this could make your SIS hard to be seen when finished.
Once you've got your depth field, this 3D information requires been encoded
in the SIS using a repetitive pattern. You will need to set proper pixels to the
same color, this color being taken from an initial pattern. The following sketch
shows the pixels (marked with 'o') on the screen that will need be allocated
with the same color. The initial ray is the one (passing right in the middle of
your eyes) that was used to determine h, the depth related to the scanned pixel
(*). Then, from the point of intersection, two rays have been drawn in the
direction of the eyes. They determine position of the linked pixels 'o',
separated by a distance dx.
This operation needs been repeated for each pixel of the scan line to produce
a field of distances dx. The hard part still remains intact: deform this pattern
to match the correlations inherent in the formation of the 3D image.
The initial pattern is drawn, say, on the left of the screen. Then, every
pixel of this pattern is redrawn at distance dx, on the right, and re-use the
new pattern it produces as initial pattern, etc...
The field dx may present discrepancies, discontinuities, due to objects
edges, sides, etc... In the point where this occur are actually points that, in
real vision, are only seen with ONE eye (eg. if your directive eye is looking
just in the center of a small box, one side of this box will be seen by the
other eye, only). They produce gaps or overlappings in the pattern deformation/
propagation. But you can ignore this overlapping or fill the gaps with what you
want (the initial pattern for instance),for this points does not take part of
the 3D-effect. As a drawback, this can cause ghost-objects to appear
when you are not focusing on the right distance (that is: the angle between your
eyes' sight direction is *nearly* good, but your lens did not catch the right
focal distance).
Because dx is not an integer, but a real number,interpolation of colors is
required to avoid pixel-level slices of the objects to be generated. Scene will
then appear smooth.
You can also start the deformation/propagation from the right or the middle
of your screen...
Once you've produced stereograms (SIRDS, SIS, or SIRTS), you may create an
animation out of the them. But some problems arise:
The pattern of the background is *not* fixed, because it's content *heavily*
depends on the position of the objects in your scene. Each new frame will
produce different background. There are some methods to damp this: let a part of
stereograms untouched by deformations, free from objects, so your eyes have a
stable part to catch in the animation. This work rather well with SIS
if your using a deformation of pattern that started, for instance, from the
left: this part of the stereograms will remain the same along the animation.
There still remains a mean to temper this effect: in fact, to gain the third
dimension in your image, you dropped one degree of freedom (colors). But there
still remains some latitude in the choice of the pattern you use. You can
choose any colors you want in a pre-definite vertical strip of your
stereogram. So, why don't you choose a 'pattern' which is, for instance, a
classicaly ray-traced image of your object, whose horizontal position can be
adjust to superimpose and match your object when the 3D-effect will take place ?
The only restriction is that your object does not extend to much beyond the
strip, for only a part of width less than X can be color-controlled by this
mean.
Is it possible to generate a stereogram such that the image is
dependent on the viewing rotation?
The short answer is YES! In a "normal" stereogram the constraints are only in
the horizontal direction, but by assigning constraints in 2-dimensions instead
of linearly across the image, it is possible. I believe the first time I saw
this was an image by Tyler [to be referenced].
--comment by John Olsen to Andrew Steer(follows)
>Also I think
it should be possible to create a stereogram which gives
>TWO images: one
when viewed landscape and another when looked at
>portrait. It would
however only be possible for certain patterns
>and NOT in general (your
average real image or logo).
Typically, you can only do a small image, entirely contained in the first
copy of the random buffer (50 pixels wide in your case). The "vertical" image is
repeated, but it gets more and more distorted as you go across the page.
There are, as you say, limited things you can do which cover greater areas,
but the limitations are rather severe. The quality of the results depends on how
much error you're willing to put up with, as "fog" and uncertainty in the
resulting image if you want both vertical and horizontal to be full page images.
Can you "tile" or "wallpaper" stereograms?
--from the net
Some people say YES!, others say NO!
Is it possible to see two *completely* different images by alternating
between the "wall-eyed" and "cross-eyed" techniques?
People have tried a simple method to ameliorate this; when generating the
stereogram alternate using a pixel for the wall-eyed or cross-eyed approaches,
this will at least half the horizontal resolution. [Has anyone tried this
alternating technique?]
From: zcapl31@ucl.ac.uk (William Andrew Steer)
Newsgroups:
alt.3d
Subject: Constructing SIRDS, Windows source code MK1
Summary: Most
basic program to draw SIRDS, written in C++ for Windows
Date: Tue, 31 May
1994 11:06:20 GMT
This is about the simplest Windows program for drawing SIRDS. It is only
bare-bones, you'll have to modify the program for alternative depth sources, and
the SIRDS is reconstructed from scratch after every WM_PAINT message ie whenever
the window is resized or uncovered. Use CTRL+ALT+DEL to exit while it's drawing.
If you don't program in C, just look at the TMyWindow::Paint function. You
should be aware that the random(arg) function returns an integer between 0 and
arg-1.
If you have Turbo C++ then make a copy of one of the example project files in
the /tcwin/owl/examples subdirectory, and copy the program below to your
/examples subdirectory. Open Turbo C++, load the new project, and change it's
contents to include just the program below and OWL.DEF. It should then run ok.
[-- later comments by Andrew Steer
I would like to stress that it
uses the 'lookback' algorithm, which has some limitations, namely:
- it
assumes that the right eye looks perpendicular to the screen while the left eye
looks slightly sideways (so the rays converge), when in reality both eyes should
look inwards. This causes asymmetry in the image (which according to some
sources makes it more difficult for some people to see) and results in near
objects appearing marginally further right than far ones.]
I have since developed algorithms for linear depth, and improved
Z-resolution. I'll post the program tomorrow [dated Tue, 31 May 1994].
// ObjectWindows SIRDS Program (C)W.A. Steer 1994
// email: w.steer@ucl.ac.uk
// Simplest routine possible
//
//
// Picture not stored
// - is completely redrawn for each WM_PAINT
#include < owl.h >
#include < math.h >
const pattwidth=96; // the basic repeat distance.
// On a 14" monitor and 640x512 display, 96 pixels
// represents about half the distance between the eyes.
const NumColors=4;
// Define the colors to use in form 0xbbggrrL
// 0x signifies hex notation
// bb blue value, gg green value, rr red value
// L tells the compiler the constant is Long ie 32bit
COLORREF cols[NumColors]=
{
0x000000L,
0x800000L,
0xFF0000L,
0x000080L
};
// ---------------- TMyWindow ----------------
class TMyWindow : public TWindow
{
public:
TMyWindow( PTWindowsObject AParent, LPSTR ATitle);
virtual void Paint( HDC PaintDC,
PAINTSTRUCT& PaintInfo );
};
TMyWindow::TMyWindow( PTWindowsObject AParent,
LPSTR ATitle) :
TWindow(AParent, ATitle)
{
Attr.W=620; // Set the default window size to 620x340
Attr.H=330;
}
void TMyWindow::Paint(HDC PaintDC, PAINTSTRUCT& )
{
int pixels[700];
int x,y;
int h; // height of 'features' above the background
int l,pl; // lookback and previous lookback distances
long r,s; // temporary storage for constructing sphere
for (y=0; y<300; y++)
{
for (x=0; x<PATTWIDTH;
((y if sphere the on point a of height Calculate
background with flush is image default by h="0;"
{ x++) x<612; (x="pattwidth;" for pl="pattwidth;" }
pixels[x]="random(NumColors);">=36) && (y<=164))
{
r=64*64-(y-100L)*(y-100L);
if (r>0)
{
s=r-(x-256L)*(x-256L);
if (s>0) h=sqrt(s)+64;
}
}
// Calculate the lookback distance
l=(int)(pattwidth-h/8.0+0.5);
// if image has got deeper (new lookback is greater
// than old lookback distance) generate a new pixel,
// otherwise repeat an old one
if (l>pl)
pixels[x]=random(NumColors);
else
pixels[x]=pixels[x-l];
pl=l;
}
// Copy the image to screen
for (x=0; x<612; x++)
{
// use the colors defined at the top in cols[]
// if you're not using Windows don't worry about
// PaintDC parameter
SetPixel(PaintDC,x,y,cols[pixels[x]]);
}
}
}
// ---------------- TMyApp ----------------
class TMyApp : public TApplication
{
public:
TMyApp(LPSTR AName, HINSTANCE hInstance,
HINSTANCE hPrevInstance, LPSTR lpCmdLine,
int nCmdShow)
: TApplication(AName, hInstance, hPrevInstance,
lpCmdLine, nCmdShow) {};
virtual void InitMainWindow();
};
void TMyApp::InitMainWindow()
{
MainWindow = new TMyWindow(NULL, Name);
}
int PASCAL WinMain(HINSTANCE hInstance,
HINSTANCE hPrevInstance, LPSTR lpCmdLine,
int nCmdShow)
{
TMyApp MyApp("Original SIRDS by W.A.Steer",
hInstance, hPrevInstance, lpCmdLine, nCmdShow);
MyApp.Run();
return MyApp.Status;
}
-- William C. Haga (wchaga@vela.acs.oakland.edu)
Being one who has used wide-eyed vision on chain link fences ever since I was
a kid, I was able to see the images in SIRDS right away. But I've had difficulty
explaining the technique to friends. Today I had the latest Games magazine with
me at my parents house. Games is running another contest using SIRDS, so there
are three in the latest issue. This time I thought of the reflection idea. So I
opened mom's china cabinet, put the magazine against the glass in the door, and
told mom to keep looking at her own reflection in the glass until the image
appeared.
It took less than thirty seconds.
When she saw the 3d train engines, I was subjected to a squeal of delight
that I hadn't heard from her for a long time. "EEK! IT'S COMING OUT AT ME! IS
THIS EVER NEAT!". Dad tried for about a minute but gave up.
About an hour later, mom and I heard a shout. We went to the dining area, and
there was dad with the magazine against the glass in the door. "Isn't that just
the most amazing thing!", said he.
Later they were making jokes about teaching old dogs new tricks.
From: jolsen@nyx10.cs.du.edu (John Olsen)
Newsgroups: alt.3d
Subject:
Call for stereograms
Date: 26 May 1994 22:16:33 -0600
A stereogram distributor has asked me to post the following info. Please
don't contact me about it. Call or write (snail mail) to him. Tell him you saw
my message on the Internet.
----
David Sterling, president of Sterling Crescent International, Inc. is
looking for commercial-grade stereograms to be included in books and as
postcards. He prefers groups of images to singles, and you must be the original
designer (owner of the copyright on the image).
Payment on accepted designs will be on a royalty basis. For an upcoming book
deal, he is trying to get all images submitted in final form by the end of June.
The postcard work is ongoing.
I'd suggest calling him once you have a list of titles together, and then
working out how to get preview copies to him (disk, paper, fax...). He's been
distributing stereogram materials for a long time (long for the stereogram
business, anyway :^), so he's picky about high quality, good detail, and
eye-catching patterns.
He is:
- David Sterling
- Sterling Crescent International, Inc
- PO Box 690253
- San Antonio, TX 78269, USA
- voice (210) 558-7143
- fax (210) 558-7144
This version of the SIRDS-FAQ was compiled by Stuart Inglis and attempts to
continue the previous excellent version maintained by Todd Hale
(todd_hale@novell.com). The latest version of the FAQ is located at
http://www.cs.waikato.ac.nz/~singlis/sirds.html. Please send all modifications
and/or comments to