Skip to the content
Walleye

How to make and view stereo images

A stereo pair is two pictures of the same thing from two nearby points. This page explains why that gives depth, how to see it without a device, and how to make pairs from photographs, from 3D models and by hand.

How depth works

Your eyes are about 6 cm apart, so each sees the world from a slightly different place. A near object lands at different positions on the two retinas. A far object lands at nearly the same position. The difference in position is called disparity. The brain reads it as depth.

Two other things happen when you look at something. The eyes turn inward until both point at it: this is convergence. The lenses change shape to bring it into focus: this is accommodation. In ordinary life the two agree. A near object needs strong convergence and strong focus.

A screen breaks the agreement. The picture is flat and at a fixed distance, so focus stays at the screen. Convergence, though, follows the depth you are shown. This conflict is one reason stereo images tire some people, especially when the depth is large (Hoffman and others, 2008).

Why parallel viewing has a limit and cross-eyed viewing does not

In parallel viewing the left image is on the left. For a point at infinity your eyes look straight ahead, so the two images of it should be as far apart as your eyes are. If corresponding points in the pair are further apart than that, your eyes would have to point outward, which most people cannot do. So corresponding points in the two panes can be at most about one eye separation apart, roughly 6 to 6.5 cm on the screen. This limits how wide each pane can be. That is why the setup page asks for your screen size.

In cross-eyed viewing the images are swapped: the left image is on the right. The eyes turn inward, which they can do by a large amount, so the panes can be as wide as you like. The price is that the eyes converge nearer than the screen, which is more tiring for many people, and that an image made for parallel viewing looks inside out until you swap it.

Free-viewing: parallel and cross-eyed

Start with the setup page so the pair is the right size. Then try one method. Most people find one easier than the other. Which one does not say anything about you.

Parallel (wall-eyed)

  1. Sit comfortably, about an arm's length from the screen, with your head level.
  2. Look at the two dots above the pair as if they were far away. Let your eyes relax, as if looking through the screen at a distant wall.
  3. The two dots will drift together and become three. Keep still. The middle dot is the one both eyes agree on.
  4. When the middle dot is steady, move your attention slowly to the picture. The middle image is the one with depth. The outer two are extra and can be ignored.

Cross-eyed

  1. Switch the viewer to cross-eyed (key S swaps modes), so the images are in the right order.
  2. Hold a finger between your eyes and the screen, in line with the dots. Look at the finger. The dots will double.
  3. Move the finger until the inner two copies of the dots merge into one. Then you have three dots.
  4. Slowly take the finger away, keeping your eyes where they are. Shift your attention to the middle image.

If the depth looks reversed, with near things behind far ones, you are viewing the wrong way. Swap the mode.

Comfort, and when to stop

Anaglyph, wiggle, and no stereo vision

Anaglyph puts the left view in red and the right in cyan. With red-cyan glasses each eye sees one view. No eye training is needed. Colour is poor, and some people see ghosting.

Wiggle (a wigglegram) alternates the two views several times a second. There is no binocular fusion. The depth comes from motion: near things move more than far things. It works with one eye. Walleye turns it off under the reduced-motion setting and gives a manual left and right toggle instead.

Some people cannot fuse a stereo pair, because of a squint, a large difference between the eyes, or sight in one eye only. A few percent of people are affected, and the exact figure depends on how it is tested, so none is given here. These readers can still get depth from motion. In Walleye, turning the object (the turntable) is also a depth cue, and so is wiggle. Both are first-class options in the viewer.

Taking stereo photographs

One camera: the cha-cha

For still scenes you need only one camera. Take a picture, shift the camera sideways by a few centimetres, and take another. Shift your weight from one foot to the other, keeping the camera level and aimed the same way. This is called the cha-cha. The first picture is the left view; the second is the right one.

How far to shift

A starting rule of thumb is the 1/30 rule: the baseline is about one thirtieth of the distance to the nearest object. A nearest object at 3 m suggests 10 cm. The rule is a start, not a law. It gives mild, comfortable depth for ordinary scenes. It fails for very close subjects, where the baseline needed is small and the pair is easy to over-do, and for far landscapes, where a larger baseline (hyper-stereo) makes the scene look like a model. A large baseline also makes things look smaller. When in doubt, take several pairs with different baselines and keep the one that fuses easily.

Two cameras

Two cameras on a bar, or two phones side by side, take both pictures at once and so handle moving subjects. They must be level with each other, point the same way, and have the same zoom and settings. Trigger them together as closely as you can. A baseline of 6 to 7 cm matches human eyes, but the cameras are usually wider than that, and the 1/30 rule then sets the closest subject.

Rules that matter

Aligning and cropping a pair

After shooting, put the two images side by side and fix three things, in this order.

  1. Rotate and shift vertically until corresponding points lie on the same horizontal line. Check with a few features far apart.
  2. Shift horizontally to choose where the scene sits relative to the screen. This sets the stereo window: the plane of the screen. Points with no horizontal offset appear at the screen. Points offset one way appear behind it, the other way in front of it.
  3. Crop both images the same way, so the edges match.

A common choice is to put the nearest object at or just behind the window, which keeps everything behind the screen and is comfortable.

Window violations

A window violation happens when an object appears in front of the window but is cut by the frame edge. Depth says the object is in front of the frame, while the edge says the frame is in front of the object. The two cues disagree and it looks wrong. Fixes: shift the pair so the object moves back behind the window; crop in from the edge on both images; or add a border in front (a floating window) by cropping one side more than the other. Without a fix, keep near objects out of the edges when you shoot.

Rendering pairs of models and mathematics

For a 3D model you are free to place the two cameras exactly, so you can avoid most problems of photography.

Off-axis, not toe-in

There are two ways to set up the cameras. In toe-in both cameras are turned inward to point at the centre of the scene. In off-axis (parallel) both cameras look in the same direction, and each camera's frustum is skewed so the two images of the screen plane coincide. Toe-in is simple but it tilts the two image planes against each other. A square far from the centre of the picture then has different heights in the two views. This is vertical parallax, and it grows towards the corners. It makes fusion harder. Off-axis gives only horizontal disparity, which is what the eyes expect. A parallel pair with a horizontal image shift (for example cropped or offset) is equivalent.

Which method the Walleye library uses is written in the API notes.

Baseline relative to distance

Use a baseline proportional to the distance from the cameras to the object, not a fixed number. Walleye's default is 6% of that distance, about 3.4 degrees between the two lines of sight. The 1/30 rule above is about 3.3% of the distance to the nearest point, so 6% is stronger. Reduce it if the pair is hard to fuse. Frame the object once, from its bounding sphere, so it does not change size as you turn it.

Using Walleye scene JSON

A scene is a small JSON file. The smallest useful one is a cube drawn as lines. Save it as examples/scenes/cube.json (or anywhere) and mount it. The full list of fields is in the scene format notes.

{
  "version": 1,
  "id": "cube",
  "title": "A cube",
  "alt": "A wire cube seen in perspective.",
  "caption": "A unit cube.",
  "credit": "Made for this guide.",
  "lines": [
    {"pts": [[-1,-1,-1],[1,-1,-1],[1,1,-1],[-1,1,-1]], "closed": true},
    {"pts": [[-1,-1, 1],[1,-1, 1],[1,1, 1],[-1,1, 1]], "closed": true},
    {"pts": [[-1,-1,-1],[-1,-1,1]]},
    {"pts": [[ 1,-1,-1],[ 1,-1,1]]},
    {"pts": [[ 1, 1,-1],[ 1, 1,1]]},
    {"pts": [[-1, 1,-1],[-1, 1,1]]}
  ]
}

To put it on a page, add the library and a div:

<script src="/walleye/lib/walleye.js"></script>
<div data-walleye data-src="/walleye/examples/scenes/cube.json"></div>

Here is a live example from the library, made the same way:

Drawing a pair by hand

Wheatstone drew his first stereo pairs by hand, as outline drawings of the same object seen from two points. You can do the same, with a ruler.

  1. Draw the object as seen from the front, on the left half of the page. Mark a few key points.
  2. Copy it to the right half, directly beside it, at the same height.
  3. Choose a depth for each point. Points at the screen plane stay where they are in both drawings.
  4. For a point nearer than the plane, shift it a little to the right in the left drawing and a little to the left in the right drawing, by the same amount. For a point farther, shift the other way. Larger depth means larger shift.
  5. Only shift horizontally. Keep heights identical.
  6. Redraw the lines between the shifted points. View the pair in parallel, or swap the halves for cross-eyed.

Keep shifts small, a few millimetres at most for a pane about 6 cm wide, so the pair stays easy to fuse. If you draw a pair for cross-eyed viewing, swap the halves.

A short history

The gallery has reconstructions of some historical figures. They are redrawn from the published figure with the source named, and are labelled as reconstructions.

Checklist

Next: open the viewer or browse the examples.

Sources