Create side-by-side stereo pairs in the Unity game engine

Paul Bourke
December 2008

Sample Island project: Island_stereo.zip

See also: Using Unity in the iDome


In the following I will outline one way of creating stereo pairs within the Unity game engine. Since Unity does not support quad buffer stereo (also known as frame sequential stereo) the approach here is suited to dual projector stereoscopic projection, most commonly this would be a polaroid or Infitec based stereoscopic systems. The technique outlined below involves parallel cameras (as opposed to toe-in) and as such creates optimal stereo pairs without vertical parallax.

The reader is assumed to be moderately familiar with Unity3D, screen shots are provided along with each step discussed. The reader is also assumed to be familiar with the basic theory required to generate "easy on the eye" stereoscopic pairs, this includes the relationship between eye separation and the distance to zero parallax. The method here requires render to texture and as such Unity-Pro is required. The example adds stereoscopic support to the demo environment that ships with Unity.

The first step is to create two cameras, one for each eye. In the following, one of the cameras of the standard first person controller is duplicated. Each camera is offset horizontally about the central position of the original camera (in this case by +-0.03 units). Two render textures are created and the cameras set to render to each one. The stereo projection system is XGA (1024x768) so 1K render textures are adequate. An open question is what eye/camera separation to use. For strictly correct stereoscopic projection a knowledge of the viewing screen is required, for this more casual setup one commonly used strategy is to choose a zero parallax distance that is equal to the distance of the camera to the ground. The eye separation then is typically (a common standard) 1/30 of this zero parallax distance. In order to give the most realistic sense of depth the field of view of the two game controller cameras should be close to the field of view of the players eyes to the bounds of the real stereoscopic display.


Click on any of the images for a larger version

The two render textures are applied to side by side square planes. These are both placed on a separate layer so they can be precluded from the first person controller cameras, and can have independent lighting applied. While not strictly necessary, a parallel light is also applied to the "stereo" layer, this provides additional control over brightness and even can apply colour (mood) effects.

Finally an orthographic camera is positioned centered on the two render texture planes. It is set to cull all layers except the stereo layer. The zero parallax is controlled by trimming columns from the left of the left image and off the right of the right image, this is described here. This trimming is controlled by the "orthographic size". However, the relationship between the player window aspect ratio and the correct orthographic size (for a particular zero parallax distance) is somewhat convoluted due to some "magic" in the choices made by Unity. The solution is simply to place an object like a small sphere temporarily in front of the camera rig at the desired zero parallax distance and adjust the orthographic size until it is indeed appears to be at zero parallax. Note that the game window below is not filled with the stereo pairs, this is because it doesn't have the right aspect ratio of 8:3 (2048x768).

The following shows the left and right image side by side. The left hand image is sent to the left eye projector and the right hand image sent to the right eye projector. In this case the splitting effect is accomplished by using the Matrox dualhead2go cards to give the desired 2048x768 pixel buffer.

The two images overlaid with 50% transparency shows how the parallax increases with distance and the front posts are at the intended zero parallax distance, and there is no vertical parallax.

In order to avoid excessive negative parallax for objects that approach the cameras one may choose to increase the front cutting plane of the two controller cameras to be some reasonable fraction of the zero parallax distance. This depends on the ghosting of the projection system, for polaroid systems this cutting plane may conservatively be set to 1/2 the zero parallax distance, this ensures that the maximum negative parallax equals the maximum positive parallax. For lower ghosting systems such as Infitec the cutting planes can be set closer to the camera.

The authors stereoscopic viewing system, rear projection linear polaroid.

Photographs of the display.

Create side-by-side stereo pairs in the Unity game engine的更多相关文章

  1. Calculating Stereo Pairs

    Calculating Stereo Pairs Written by Paul BourkeJuly 1999 Introduction The following discusses comput ...

  2. CREATE A ENERGY / HEALTH BAR HUD

    Now then, let's get started. 1. Open the Play scene which you had created in the previous post. If y ...

  3. 13.1.17 CREATE TABLE Syntax

    13.1.17 CREATE TABLE Syntax 13.1.17.1 CREATE TABLE ... LIKE Syntax 13.1.17.2 CREATE TABLE ... SELECT ...

  4. MySQL create table 语法

    MySQL中create table语句的基本语法是: CREATE [TEMPORARY] TABLE [IF NOT EXISTS] tbl_name     [(create_definitio ...

  5. (转) Awesome Deep Learning

    Awesome Deep Learning  Table of Contents Free Online Books Courses Videos and Lectures Papers Tutori ...

  6. 计算机视觉code与软件

    Research Code A rational methodology for lossy compression - REWIC is a software-based implementatio ...

  7. What are some good books/papers for learning deep learning?

    What's the most effective way to get started with deep learning?       29 Answers     Yoshua Bengio, ...

  8. Halcon四 双目视觉的标定

    原文作者写的一系列博客,挺不错的学习halcon:http://blog.sina.com.cn/s/blog_442bfe0e0100yjtn.html 1.get_image_pointer1(I ...

  9. Computer Generated Angular Fisheye Projections [转]

    Computer GeneratedAngular Fisheye Projections Written by Paul Bourke May 2001 There are two main ide ...

随机推荐

  1. [转]:Delphi 中的哈希表(1): THashedStringList

    unit Unit1; interface uses Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms ...

  2. Markdown写博客

    一级目录 我接下来是不是该写二级目录了 二级目录 如果我用桌面端的Markdown会不会好很多,这个我看不到效果 听说插入表格很麻烦? 列表是这样的? 我还看不出样子 *这个是什么样子啊 引用是这样用 ...

  3. 使用Maven来写j2ee项目

    第一步:使用Maven创建web项目 是不是很简单? 第二步 问题 很多人,创建好后是没有src/main/java的源文件的,解决办法: 1.直接new ResourceFloder,src/mai ...

  4. XMl.02-约束

    DTD约束 DTD的书写位置 XML构建模块 DTD定义元素 DTD属性的定义 DTD实体的定义 schema约束 命名空间 schema约束的书写流程 XML被设计为一种很灵活的标记文档. 但是,有 ...

  5. Python:关于字典的相关操作

    >>> people = {"Tom":170, "Jack":175, "Kite":160, "White& ...

  6. 自动化前端构建工具--gulp

    Gulp是一个基于任务的javascript工程命令行流式构建工具.为什么要用Gulp呢?前端开发进入到工程化阶段,我们需要压缩合并文件,加MD5戳:如果使用 CoffeeScript/ES6 去代替 ...

  7. http协议get、post请求分析及用HttpRequester测试的报错及可能原因

    1.get.post区别 Get Post 获取/提交数据 主要获取数据,不修改数据 主要提交数据,可修改数据 是否需要form表单 不一定 需要 安全性 查询字符串会显示在地址栏的URL中,不安全. ...

  8. windbg命令----!idt

    !idt扩展显示指定的中断分配表(interrupt dispatch table (IDT))中的中断服务例程(interrupt service routine (ISR)) -a 没有指定IDT ...

  9. 协同开发中SVN的使用建议

    协同开发中SVN的使用建议 1.  注意个人账户密码安全 各员工需牢记各自的账户和密码,不得向他人透漏,严禁使用他人账户进行SVN各项操作(主要考虑每个SVN账号的使用者的权限范围问题).如有忘记,请 ...

  10. mysql高性能索引策略

    转载说明:http://www.nyankosama.com/2014/12/19/high-performance-index/ 1. 引言 随着互联网时代地到来,各种各样的基于互联网的应用和服务进 ...