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. Kubernetes集群初探

    上文我们在一台虚机上演示了Kubernetes基于redis和docker的guestbook留言簿案例,本文我们将通过配置Kubernetes集群的方式继续深入研究.集群组件安装如下配置. IP N ...

  2. tableView中cell的重用机制

    如果用UITableView显示成千上万条数据,就需要成千上万个UITableViewCell对象,然而OS设备的内存是有限的,这样就将耗尽iOS设备的内存.要解决这个问题,需要提到重用UITable ...

  3. Ninject之旅之三:Ninject对象生命周期

    摘要 DI容器的一个责任是管理他创建的对象的生命周期.他应该决定什么时候创建一个给定类型的对象,什么时候使用已经存在的对象.他还需要在对象不需要的时候处理对象.Ninject在不同的情况下管理对象的生 ...

  4. 让window.close不提示:您查看的网页正在试图关闭窗口。是否关闭此窗口?

    正常来说,当我们调用window.close来关闭从地址栏中打开的窗口时,IE会弹出提示说:您查看的网页正在试图关闭窗口,是否关闭此窗口? 你可以将window.close替换成下边的脚本,然后再测试 ...

  5. 『c++』 模板(template)--- 参数化多态性

    ---恢复内容开始--- 题外话: 模板机制的设计和细节是由Bjarne Stroustrup在其1988年10月发表的名为“Parameterized Types for C++”一文中披露的. 引 ...

  6. 运行R 报错R cannot R_TempDir, 继而发现/dev/mapper/VG00-LV01 磁盘空间已满

    今天在运行R脚本的时候报了个错:Fatal error: cannot create 'R_TempDir'.排除了是自己写的代码的问题,想着应该是某个没见过的原因,google之,发现网上的说法是/ ...

  7. SQL Server类型的对应关系

    bit bool tinyint byte smallint short int int bigint long real float float double money decimal datet ...

  8. python之路-Day6

    time & datetime模块 #_*_coding:utf-8_*_ __author__ = 'Alex Li' import time # print(time.clock()) # ...

  9. APP测试之登录

    我们公司产品登录很简单 手机号为账号,每次登录输入短信验证码.验证码为6位数字.登陆后可以记录登录状态.未登录时可以微信登录然后验证或者APP登录后可以在个人中心绑定微信. 一APP内部登录 1.手机 ...

  10. MdZ计算重调和特征值

    >> [eigvH,eigv] = MdZ2grid3d(/,) eigvH = 6.8775e+003 eigv = 5.0224e+003 >> [eigvH,eigv] ...