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

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

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

Unity Manual > User Guide > Building Scenes > Cameras

Unity手册->用户指南->创建场景->摄像机

Just as cameras are used in films to display the story to the audience, Cameras in Unity are used to display the game world to the player. You will always have at least one camera in a scene, but you can have more than one. Multiple cameras can give you a two-player splitscreen or create advanced custom effects. You can animate cameras, or control them with physics. Practically anything you can imagine is possible with cameras, and you can use typical or unique cameras to fit your game's style.

正如摄像机用于电影显示故事给观众,在Unity里摄像机用于显示游戏世界给玩家。在一个场景里,你总是拥有至少一个摄像机,但你可以拥有超过一个的摄像机。多个摄像机可以给你两个玩家分屏或建立高级的客户效果。你可以动画摄像机,或物理控制它们。你可以设想几乎任何事情是摄像机发生的已经你可以使用典型的或独特的摄像机以适合你的游戏的风格。

The remaining text is from the Camera Component reference page.

剩余的文本来自于摄像机组件引用页。

Camera 摄像机

Cameras are the devices that capture and display the world to the player. By customizing and manipulating cameras, you can make the presentation of your game truly unique. You can have an unlimited number of cameras in a scene. They can be set to render in any order, at any place on the screen, or only certain parts of the screen.

摄像机是捕获和展示世界该玩家的设备。通过定制和操纵摄像机,你可以使你的游戏真正独一无二的展示。在场景里你可以拥有不限数量的摄像机。它们可以被设置为任何顺序渲染、在屏幕的任何地方或仅是屏幕的以部分。

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

Unity's flexible Camera object  Unity的灵活的设计摄像机对象。  

Properties 属性

Clear Flags

清除标志

Determines which parts of the screen will be cleared. This is handy when using multiple Cameras to draw different game elements.

确定屏幕的哪些部分将被清除。这是方便的当使用多个摄像机去绘制不同游戏元素时。

Background color

背景颜色

Color applied to the remaining screen after all elements in view have been drawn and there is no skybox.

颜色应用于在所有在视图里的元素已经被绘制和没有天空盒之后的屏幕的剩余部分。

Normalized View Port Rect

标准视口矩形

Four values that indicate where on the screen this camera view will be drawn, in Screen Coordinates (values 0-1).

四个值在屏幕上指定哪里,摄像机视图将被绘制,在场景里相配(值 0-1)

X

The beginning horizontal position that the camera view will be drawn.

摄像机视图开始的水平位置将被会绘制。

Y

The beginning vertical position that the camera view will be drawn.

摄像机视图开始的垂直位置将被会绘制。

Width 宽度

Width of the camera output on the screen.摄像机输出到屏幕上的宽度

Height 高度

Height of the camera output on the screen.摄像机输出到屏幕上高度

Near clip plane近剪辑平面

The closest point relative to the camera that drawing will occur.

相对于摄像机的最近点绘制将出现。

Far clip plane 远剪辑平面

The furthest point relative to the camera that drawing will occur.

相对于摄像机的最远点绘制将出现。

Field of view 视界

Width of the Camera's view angle, measured in degrees along the local Y axis.摄像机视角的宽度,沿本地y轴度量。

Orthographic 正交投影

Toggles the camera's capability to simulate perspective.切换摄像机的性能去模拟远景

Orthographic size 正交投影大小

The viewport size of the Camera when it is Orthographic.

当它是正交投影时,摄像机的视口大小。

Depth 深度

The camera's position in the draw order. Cameras with a higher depth will be drawn on top of cameras with a lower depth value.

在绘制顺序里的摄像机的位置。拥有一个高深度的摄像机将紧接着所有低深度值的摄像机被绘制。

Culling Mask 剔除面具

Include or omit layers of objects to be rendered by the Camera. Assign layers to your objects in the Inspector.

通过摄像机渲染包含或剔除对象的层。 在检视器里指定层到你的对象。

Render Target (Unity Pro only) 渲染目标(Unity专业版仅有)

Reference to a Render Texture that will contain the output of the Camera view. Making this reference will disable this Camera's capability to render to the screen.

引用一个包含摄像机视图输出的渲染纹理。使这个纹理将停用这个摄像机的性能去渲染屏幕。

Details 详细资料

Cameras are essential for displaying your game to the player. They can be customized, scripted, or parented to achieve just about any kind of effect imaginable. For a puzzle game, you might keep the Camera static for a full view of the puzzle. For a first-person shooter, you would parent the Camera to the player character, and place it at the character's eye level. For a racing game, you'd likely want to have the Camera follow your player's vehicle.

给玩家显示你的游戏摄像机是必需的。它们可以被定制、脚本或父类化取得恰当的任何可想象效果类型。对于一个益智游戏,你也许保持益智游戏全景视图的静态摄像机。对于一个第一人称射击,你将父类化摄像机给玩家角色以代替角色的视觉水平。对于赛车游戏,你可能希望有摄像机根须你的玩家的汽车。

You can create multiple Cameras and assign each one to a different Depth. Cameras are drawn from low Depth to high Depth. In other words, a Camera with a Depth of 2 will be drawn on top of a Camera with a depth of 1. You can adjust the values of the Normalized View Port Rectangle property to resize and position the Camera's view onscreen. This can create multiple mini-views like missile cams, map views, rear-view mirrors, etc.

你可以创建多个摄像机并指定每个摄像机不同的深度。摄像机从低深度到高深度绘制。换句话说,一个拥有深度2的将紧接着深度为1的被绘制。你可以调整水平视口矩形属性的值去调整大小和摄像机的视图在屏幕上的位置。这可以创建多个小视图就像发射物齿轮、地图窗口,后视镜等等。

Clear Flags 清除标志

Each Camera stores color and depth information when it renders its view. The portions of the screen that are not drawn in are empty, and will display the skybox by default. When you are using multiple Cameras, each one stores its own color and depth information in buffers, accumulating more data as each Camera renders. As any particular Camera in your scene renders its view, you can set the Clear Flags to clear different collections of the buffer information. This is done by choosing one of the four options:

当摄像机渲染它的视图时,每个摄像机存储颜色和深度信息。 屏幕的一部分是不绘制是空的,将默认被显示为天空。当你使用多个摄像机,每个摄像机存储它自己颜色和深度信息在缓存里、积累多的数据做个每个摄像机渲染。做为任一特殊的摄像机在你的场景里渲染它自己的视图,你可以设置清除标志去清除不同缓存信息的集合。这样做通过四个选项之一:

Skybox 天空盒

This is the default setting. Any empty portions of the screen will display the current Camera's skybox. If the current Camera has no skybox set, it will default to the skybox chosen in the Render Settings (found in Edit->Render Settings). It will then fall back to the Background Color.

这是默认设置。任何场景的空白部分将先显示当前摄像机的天空盒。如果当前摄像机没有天空盒设置,它将默认为在渲染设置里(在Edit->Render Settings里找到)选择的天空盒。此后,它将回退到背景颜色。

Solid Color 纯色

Any empty portions of the screen will display the current Camera's Background Color.

屏幕的任何空白部分将显示当前摄像机的背景颜色。

Depth Only 独立深度

If you wanted to draw a player's gun without letting it get clipped inside the environment, you would set one Camera at Depth 0 to draw the environment, and another Camera at Depth 1 to draw the weapon alone. The weapon Camera's Clear Flags should be set to to depth only. This will keep the graphical display of the environment on the screen, but discard all information about where each object exists in 3-D space. When the gun is drawn, the opaque parts will completely cover anything drawn, regardless of how close the gun is to the wall.

如果你想去绘制一个玩家的枪 没有让它获得环境内侧剪辑,你应该设置摄像机在深度0绘制环境,其它摄相象在深度1绘制独立武器。武器摄像机的清除标志应该被设置为唯一深度。这将保持屏幕上环境图片显示,但是丢弃所有有关的每个对象存在于3D空间的地点信息。当枪被绘制时,不透明部分将完全覆盖任何事物绘制,不管抢是如何接近墙。

Unity3D基础教程2-5:摄像机(Cameras)
The gun is drawn last, after clearing the depth buffer of the cameras before it

抢被最后一次绘制,在摄像机的深度缓存清除前后。

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