Last modified on 1 September 2011, at 08:17

Blender 3D: Noob to Pro/Add some depth with stereo

This tutorial contains some tips for how to work with stereo images.

Stereo viewing is to see the same thing from two slightly different angles. This is what humans normally do with their two eyes. There are many ways to view a stereo image. A perfect method is to use a stereo monitor. But they are quite expensive, and many are of very low quality. In the other end of the price-scale you can use crossviewing. Put the two images next to each other, and look at one with one eye, and the other with the other eye. Needs a bit of practice though. A popular solution is red/blue anaglyph glasses, but they give very bad colors.

The stereo cameraEdit

I wanted a stereo camera rig that was easy to work with. It should have three cameras (center, left right), have an easy way to set separation (should be 1/30 of the distance) and I would only need to work with the center cam (position etc.), to others should just follow.

Create itEdit


  1. Reset the cameras position, rotation and size (you can use  Alt + G ,  Alt + R  and  Alt + S ). You may want to note these values first, so you can change them back later. I just make sure there's an IPO-curve for them, for example by making a keyframe ( I ).
  2. Create two new cameras. Reset their position, rotation and size too.
  3. Name them Camera.Right and Camera.Left or similar. Set LocX to 1 for Camera.Right and -1 for Camera.Left. (Press  N  to see data for selected object, in this window you can change name and values.) (Select a camera by clicking  RMB  several times on the cameras, until the right one is selected.)
  4. Create a new cube (remember to press  Tab  to exit edit mode). Reset position, rotation and size. Name it Distance Cube and set these values: LocZ: -30. SizeX: 0.1. SizeY: 0.1. SizeZ: 30.
  5. Switch to front view. ( 1 )
  6. Select Camera.Left. Then select Camera while holding down  Shift  so both are selected. Press  Ctrl + P  and press  Enter  to register Camera as parent. Then press  Ctrl + L  and select Camera Data. Repeat with right Camera.Right and Distance Cube.

With a scriptEdit


Editor's note
I tried making a script that creates the rig, it almost works. Any help finishing it?

import Blender
from Blender import *
# Prepare
scene = Scene.getCurrent()
camera = Object.Get("Camera") # TODO validate that it is a camera
oldLocation = camera.loc
oldRotation = camera.rot
oldSize = camera.size
# Create stuff
c = Camera.New("ortho")
cameraLeft = Object.New("Camera", "Camera.Left")
c = Camera.New("ortho")
cameraRight = Object.New("Camera", "Camera.Right")
dEmpty = Object.New("Empty", "Distance")
# Configure
camera.loc = (0,0,0)
camera.rot = (0,0,0)
camera.size = (1,1,1)
cameraLeft.loc = (-1,0,0)
cameraLeft.rot = (0,0,0)
cameraLeft.size = (1,1,1)
cameraRight.loc = (1,0,0)
cameraRight.rot = (0,0,0)
cameraRight.size = (1,1,1)
dEmpty.loc = (0,0,-60)
dEmpty.rot = (0,0,0)
dEmpty.size = (1,1,1)
# Connect
camera.makeParent([cameraLeft, cameraRight, dEmpty], 0, 0)
# do that CTRL+LKEY thing"Camera"))"Camera")) 
# Reset original values
camera.loc = oldLocation
camera.rot = oldRotation
camera.size = oldSize
# Finish

How to use itEdit

  • Never change the cube or the two side-cameras. Only change the center camera. Use that one for positioning, rotation etc.
  • To set the separation: As always, select the center camera. Resize it (with  S ) so you can see the end of the cube if needed. Point at the end of the cube with the mouse pointer, and press  S . Move the mouse pointer to the point of the main motive, that is closes to the camera. The end of the cube may not end exactly there, but that doesn't matter.
  • To render (or preview) with one of the side cameras, select it and press  Ctrl + 0 .

What needs improvementEdit

The cube is visibleEdit

Instead of using a cube, I'd rather use something that doesn't render. It could be an "empty", but see below.

The cube is hard to seeEdit

It can be hard to see where the cube ends, even in a simple scene. You can select the center camera AND the cube, then it is clearly visible. But you must remember to only select the camera, before you insert a keyframe, so your changes to the cube doesn't get saved.

Distance plane is at infinityEdit

The distance plane is where "zero depth is". When viewing a stereo image, the distance plane is where the medium is. In this rig the distance plane is at infinity, meaning everything is in front of it. While stuff popping out in front of the screen is cooler than stuff being "inside" the screen, it's a lot harder to make it look nice. Specially because with everything in front of the screen, it's easy to get stuff that is just way to close to the viewer. It can get so hard to see that the 3d-effect is completely gone.

A different solution is to make the side cameras point at the end of the cube, or add a plane to the rig, and point at that. But then the cameras are no longer parallel, and that creates distortion.

The compromise solution is to (conceptually) render the images too wide, and then crop the excess from the left side of the left image, and the right side of the right image. Then it will look like it points just like in the previously mentioned solution, but without the distortion.

But this give a lot of problems. First, I'd like to do this a smarter way, instead of just following the path describe above. But I don't think that's possible in Blender. (I think povray can actually do this.) So I need to render the image too wide. But if I increase width in output, it actually renders the same width of the motive, but decreases height. Then I need to do some weird math to get the right FOV, and I don't know half the formulas. Cropping must be done outside Blender, and the rest of "the production line" is hard to get back into Blender if wanted.

I guess a couple of planes in the rig close to the cameras could simulate the cropping, but that is of limited value. To make an adjustable distance plane with them seems quite hard to me, it would need some scripting I guess.

Stereo viewing with the rigEdit

This is where it gets exciting, now you are actually getting something to look at.

  1. Create a new screen, you could call it Stereo View.
  2. The screen should have one big area from side to side.
  3. Set the area to 3D View
  4. Unlock it (The Locks layers and used Camera to Scene-lock)
  5. Select Camera.Right and press  Ctrl + 0 
  6. Split the area in half so there is two parts next to each other
  7. In the right area, select Camera.Left and press  Ctrl + 0 
  8. Adjust zoom in both areas so the frame that shows what is rendered is completely visible, but fill as much as possible. If you can't make them same size, the two areas are not same size.
  9. Use cross-view method to see the 3d-effect. Look at the left area with the right eye and right area with the left eye. (It's a skill you need to learn and practice.)
  10. Press  Shift + Alt + A  to see your scene animated in stereo.

If you cannot see these, there is a lot of help with viewing them on the web. Use a search engine to find them.

Stereo renderingEdit


Create two render layers in the Render Layers tab.

Render Layers tab.png

Editor's note
You need to find how to associate one camera with one render layer

Then go the Node Editor and click on the button with a human face. Click on Uses nodes and remove the created items by selecting the items and clicking on  Del . Now, using the Add menu, you need to do this diagram:

Blender's Node Editor anaglyph diagram.png

Once done, return to the Buttons window and select the button Do Composite on the Anim tab:

Anim tab.png

Then click on the button Render on the Render tab:

Render tab.png

You should see your objects as an anaglyph:

Suzanne as anaglyph rendering on Blender.jpg