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
在这篇文章中我将概要的描述在unity游戏引擎中创建立体相对的方法。尽管Unity不支持四重缓冲立体(也叫帧序列立体),这里的方法适用于双投影仪立体投影,大多数情况下这是基于偏振或者光谱立体的立体系统。下面描述的方法包括平行相机(而不是前倾的),用这种方法创建没有垂直视差的最优立体相对。
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.
第一步创建两个相机,每只眼睛一个。接下来,复制一个标准第一人称控制器(standard first person
controller)的其中一个相机(里面本来就有一个相机)。每个相机相对于中心相机(指的是SFPC自带的那个相机)水平地偏移(这里是+-0.03单位)。创建两个渲染纹理,给每个相机绑定一个。由于立体投影系统是XGA(1024x768)的,所以1K的渲染纹理就足够了。有一个问题是,使用多大的视间距。严格来说,对于正确的立体投影必须知道正在看的屏幕;比较随意的一个做法通常是选择一个零视差距离,该距离和相机到地面的距离是相等的。然后视间距通常是零视差距离的1/30(通用标准)。为了实现最优真实感的深度,两个相机视野的夹角应该和玩家眼睛视野的夹角接近,和真正立体显示的范围接近。
![]() Click on any of the images for a larger version
The two render textures are applied to side by side square
planes.
把这两个渲染纹理放到并排的正方平面上,并把这两个渲染纹理放在一个单独的图层上,防止第一人称控制器对它们渲染,并且具有独立的光照。然而并非必要的是,可以给“立体”图层加一个一个平行光,这样就能对亮度进行额外的控制,甚至能使用颜色特效。
![]()
Finally an orthographic camera is positioned centered on the two
render texture planes. It is set to cull all layers except the
stereo layer.
然后在两个渲染纹理平面的中间位置放置一个正射投影的相机,然后设置其只渲染立体图层。我们通过去掉左侧图像的左边部分和右边图像的右边位置来控制零视差,在这里有介绍(另外一篇博文)。这种修边处理可以通过正射投影的范围大小来控制。但是,玩家的窗口比例和正确的正射投影范围大小(对一个特殊的零视差距离来说)之间的关系有些令人费解,因为Unity所做选择中的一些“magic”。解决方法是,在相机前面临时放一个类似小圆球的东西来调整想要的零视差距离,并调整正射投影的范围大小,直到出现了零视差。要注意的是,下面的游戏窗口没有填满立体相对,这是因为窗口没有正确的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. ![]() ![]() |
|
来自: 勤奋不止 > 《游戏引擎unity》