Unity3D基础教程2-5:摄像机(Cameras)

2014-08-08 18:13:22|?次阅读|上传:huigezrx【已有?条评论】发表评论

关键词:Unity3D, 游戏, 虚拟现实|来源:唯设编程网

Don't Clear 不清除

This mode does not clear either the color or the depth buffer. The result is that each frame is drawn over the next, resulting in a smear-looking effect. This isn't typically used in games, and would likely be best used with a custom shader.

这个模式不清除任一的颜色或深度缓存。其结果是每帧被绘制在下一个之上,造成在一抹黑里的效果。在游戏里这不经常使用,有可能最好使用一个定制的阴影。

Clip Planes 剪辑平面

The Near and Far Clip Plane properties determine where the Camera's view begins and ends. The planes are laid out perpendicular to the Camera's direction and are measured from the its position. The Near plane is the closest location that will be rendered, and the Far plane is the furthest.

近处和远处剪辑面属性决定摄像机视图开始与结束的地方。平面是垂直布局于摄像机的方向并从它自己的位置来衡量。近处剪辑是接近渲染的本地,远处剪辑是最远的。

The clipping planes also determine how depth buffer precision is distributed over the scene. In general, to get better precision you should move the Near plane as far as possible.

剪辑的平面同样确认缓存精度如何分布在场景上。一般而言,去获得较好的精度你应该移动近处剪辑尽可能的远。

Culling Mask 剔除面具

The Culling Mask is used for selectively rendering groups of objects using Layers. More information on using layers can be found here.

剔除面具被用于选择性的渲染对象组使用的层。使用层的更多信息在这里。

Commonly, it is good practice to put your User Interface on a different layer, then render it by itself with a separate Camera set to render the UI layer by itself.

一般地,一个良好的做法是把你的用户界面放置一个不同的层,然后渲染它它,利用各自摄像机设渲染它自己的UI层。

In order for the UI to display on top of the other Camera views, you'll also need to set the Clear Flags to Depth only and make sure that the UI Camera's Depth is higher than the other Cameras.

为了用户界面(UI)显示在其它摄像机的上面,你应该同样需要设置清除标志为单独深度并确定UI摄像机的深度是比其它摄像机高的高度。

Normalized Viewport Rectangle 标准视口矩形

Normalized Viewport Rectangles are specifically for defining a certain portion of the screen that the current camera view will be drawn upon. You can put a map view in the lower-right hand corner of the screen, or a missile-tip view in the upper-left corner. With a bit of design work, you can use Viewport Rectangle to create some unique behaviors.

标准视口矩形是特定定义一个屏幕的某一部分,当前摄像机视图将被绘制在上面。你可以放置一个地图视图在屏幕右手下角落里,或一个导弹提示视图在左上角。就设计工作的一点,你可以使用视口矩形去创建一些独特的行为。

It's easy to create a two-player split screen effect using Normalized Viewport Rectangle. After you have created your two cameras, change player one's Ymin value to 0.5, and player two's Ymax: value to 0.5. This will make player one's camera display from halfway up the screen to the top, and player two's camera will start at the bottom and stop halfway up the screen.

使用标准视口矩形很容易创建两个玩家分屏效果。在你已经建立两个摄像机之后,更改两个玩家之一的Ymin(y最小值)值为0.5,已经两个玩家的Ymax(y最大值)为0.5。这将使玩家之一的摄像机从屏幕的中部向上到顶部显示,以及第二个玩家的摄像机将开始在底部及停止在屏幕的中部。

Unity3D基础教程2-5:摄像机(Cameras)
Two-player display created with Normalized Viewport Rectangle 两个玩家显示利用标准视口矩形创建的。

Orthographic 正交投影

Marking a Camera as Orthographic removes all perspective from the Camera's view. This is mostly useful for making isometric or 2D games.

使一个摄像机作为正交投影从摄像机的视图里删除所有透视。这是通常用于做等角(正交)或2D游戏。

Unity3D基础教程2-5:摄像机(Cameras)
Perspective camera 透视摄像机.

Unity3D基础教程2-5:摄像机(Cameras)
Orthographic camera. Objects do not get smaller with distance here! 正交摄像机,对象不再获得小的位距这里!

Render Texture 渲染纹理

This feature is only available for Unity Pro licenses (not applicable to any version of Unity iPhone). It will place the camera's view onto a Texture that can then be applied to another object. This makes it easy to create sports arena video monitors, surveillance cameras, reflections etc.

这个特性仅是Unity 专业版本据有的许可(不适用于Unity iPhone的任何版本)。它将放置摄像机视图在一个纹理上,然后可以被用于其它对象。这很容易的去创建体育场检视器,检视摄像机,反射等。

Unity3D基础教程2-5:摄像机(Cameras)
A Render Texture used to create a live arena-cam 一个渲染纹理被用于创建一个实况转播体育场

Hints 提示

Cameras can be instantiated, parented, and scripted just like any other GameObject.

摄像机可以被实例化、父类化、以及脚本化就像任何其它GameObject(游戏物体)。

To increase the sense of speed in a racing game, use a high Field of View.

为增加场景的速度感在一个赛车游戏里,使用高可视区。

Cameras can be used in physics simulation if you add a Rigidbody Component.

摄像机可以被用于物理仿真里如果你添加一个刚体组件。

There is no limit to the number of Cameras you can have in your scenes.

没有限制你拥有的摄像机的数量在你的场景里。

Orthographic cameras are great for making 3D user interfaces

正交投影摄像机可以制作3D用户界面。

If you are experiencing depth artifacts (surfaces close to each other flickering), try setting Near Plane to as large as possible.

如果你遇到史前古物深度技巧(表面接近的彼此闪烁),尝试设置近处平面尽可能的大。

Cameras cannot render to the Game Screen and a Render Texture at the same time, only one or the other.

摄像机不能渲染游戏场景和一个渲染纹理在同一时间,统一时间只能一个。

Pro license holders have the option of rendering a Camera's view to a texture, called Render-to-Texture, for even more unique effects.

专业版许可者拥有渲染的一个摄像机视图的渲染选项对一个纹理,称为渲染到纹理,为了更独特的效果。

Unity comes with pre-installed Camera scripts, found in Components->Camera Control. Experiment with them to get a taste of what's possible.

Unity配置了预安装摄像机脚本,在Components->Camera Control里找到。实验它们去获得可能发生的什么体验。

<12>
发表评论0条 】
网友评论(共?条评论)..
Unity3D基础教程2-5:摄像机(Cameras)