字幕表 動画を再生する
Cameras.
ここではカメラについてみていきます。
The camera is one of the most
カメラは Unity における
essential components in Unity.
もっとも重要なコンポーネントのひとつです。
The camera takes the contents of our scene
カメラはシーンのコンテンツを
and displays it to our users.
ユーザに対して表示します。
Every scene must have at least
すべてのシーンには、シーンのオブジェクトをレンダリングするために
one camera to render out scene objects
少なくともひとつのカメラが必要であり、
otherwise we have nothing to show.
ないと何も表示されません。
When a new scene is created
新規のシーンが作成されるとき
one game object is always created.
ひとつのゲームオブジェクトがつねに作成されます。
This is the main camera.
これがメイン カメラ (Main Camera) です。
The game view camera is a
ゲームビュー カメラとは
component attached to a game object.
ゲームオブジェクトにアタッチされるコンポーネントです。
This means we can manipulate, or move our camera
つまり、カメラは他のゲームオブジェクトとまったく同じように
like any other game object,
操作して、移動できて
including parenting, scripting,
親子関係やスクリプティング、
or physical interaction.
物理挙動を与えることにも対応しています。
To create a first or third person camera,
1人称 (First Person)、 3 人称 (Third Person) 視点
including side scrollers,
さらに横スクロールでのカメラをを作成するとき
we can use the player object as the parent.
プレイヤーオブジェクトを親として使用できます。
For first person cameras, make sure the camera
First Person カメラでは、カメラが
is at the character's eye height
キャラクターの目の高さにあり
looking forward from the character's point of view.
キャラクターの立場から正面を向いていることを確認して下さい。
For a third person view, make sure the camera is
Third Person ビューからは、カメラが
above and behind the character.
キャラクターより上で後ろにあることを確認して下さい。
For a simple puzzle game or top-down shooter
単純なパズルゲームまたは縦スクロールシューティングの場合、
the camera would be static, simply
カメラは静的であり、
looking at and rendering the game.
ゲームの方向へ向いてレンダリングを行ないます。
In this example we are going to centre the camera,
このサンプルではカメラをセンタリングして
remove any unwanted rotation,
不要な回転をすべて取り除いて、
point it straight down and lift it above
真っ直ぐ下を向かせてゲームボードの上に
the game board to simulate a top-down game.
位置させてトップダウンのゲームをシミュレーションします。
In this case we are using the orthographic
このケースではカメラの Orthographic モードを
mode on the camera, which we will cover
使用しますが、これについては
later in this lesson.
このレッスンで後ほど解説します。
We can have any number of cameras in our scene.
シーンには任意の数のカメラを持たせることが出来ます。
Each rendering different parts of the environment.
それぞれがゲーム環境の異なる部分をレンダリングさせることが出来ます。
In this example we have three cameras.
このサンプルでは 3 つのカメラを用意しました。
One rendering all of the dynamic
ひとつがシーンのすべての動的な
objects in the scene. Another rendering
オブジェクトをレンダリングしています。もうひとつは
the static background and a third
静的な背景をレンダリングして、 3 つめは
rendering a User Interface overlay.
上に重ねたユーザインタフェースをレンダリングします。
All three cameras can be brought together to
3 つのカメラを全てひとつにまとめて
make a single presentation to our user.
ユーザにとってひとつの表示をさせることが出来ます。
We will talk about how to properly use all
3 つのカメラ全てを同時に使用する
three cameras at once later on in this lesson.
正しい方法はこのレッスンの後の方で解説します。
When a camera is selected in the hierarchy
カメラが Hierarchy ビューで選択されたとき
we see a preview of the camera in the scene.
シーン上でカメラのプレビューが表示されます。
When we have multiple cameras in the scene
シーンに複数のカメラがあるとき
this helps us to see what the camera is rendering.
これによりカメラが何をレンダリングするかを見るのに役立ちます。
This preview is also helpful when we are in
このプレビューは全画面モードであるときに
full screen mode to see what the camera is rendering,
役立ち、例えカメラがひとつだけの場合も
even if it's the only camera in the scene.
カメラが何をレンダリングしているかみることが出来ます。
Cameras will render everything that's in
カメラは正面にあるものの全てを
front of them and within their view.
そのビューの中にレンダリングします。
How much of the scene is within their view
シーン全体のどこまでがビューの範囲に表示されるか
is shown in the scene view as a white outline.
は白い枠線つきでシーンビューに表示されます。
This shape is a view frustum.
これはビュー Frustum と呼ばれるものです。
A view frustum is a pyramid, or cone,
ビュー Frustum の形状はピラミッドまたは
with the top cut off.
錐体の上の部分を切り取ったような形です。
The cut off top of the pyramid is the
ピラミッドの上の部分の切り取った部分は
near clipping plane and the base
ニア クリッピング プレーン(near clipping plane)と呼ばれ、
is the far clipping plane.
土台の部分が ファー クリッピング プレーン(far clipping plane)と呼ばれます。
The near and far clipping planes control
ニアおよびファー クリッピング プレーンは
the draw distance from the camera.
カメラの描画する距離を制御します。
Objects must be between the near and far
レンダリングする対象となるためには
clipping planes to be rendered. The sides
ニアおよびファーの間にある必要があります。
indicate how much the camera can see
横の部分はカメラが端から端のどこまで見えるか、
side to side and top to bottom.
さらに上から下のどこまで見えるかを示します。
and any part of the scene that's within
そしてシーンのうち、 Frustum の範囲にある
the frustum will be rendered.
部分はすべてレンダリングされます。
Cameras have two different ways of
カメラにはシーンを見るために
looking at the scene. Perspective mode
二つの方法が用意されてます。Perspective モードと
and orthographic mode.
Orthographic モードです。
These dramatically effect the shape and
どちらの方法をとるかにより Frusum の形状および
size of the frustum and the
サイズ、さらにはカメラを通したシーンの見た目は
look of the scene through the camera.
劇的に変化します。
In perspective mode the camera will render
Perspective モードではカメラはシーンを
the scene like a real world camera with
現実世界のカメラのようにレンダリングして
a sense of diminishing perspective.
遠近法のような図法になります。
We can see this in the scene view as the
これはシーンビューで確認することが出来て
white representation of the cameras
白で表現されているカメラの Frustum は
frustum gets larger as it extends
カメラから遠ざかるにつれて
away from the camera.
大きくなります。
This is the most common camera mode to use
これはゲーム作成時にもっとも一般的に使用される
when creating a game.
カメラのモードです。
In orthographic mode there is no
Orthographic モードでは
diminishing perspective. All objects are
遠近法のような表現はありません。すべてのオブジェクトは
rendered using a form of parallel
カメラを通した、
projection from the camera. We can see this
平行透視のような画法になります。みてのとおり
in the scene view as the frustum is straight
シーンビューにおいて Frustum が真っ直ぐであり
and the front and back are the same size.
前および後ろの部分が同じ大きさになっています。
This mode is usually seen in isometric
このモードはおもにリアルタイム戦略ゲーム、ボードゲーム、
games like some real time strategy or
2D ゲーム、パズルゲームといった
board games, or for 2D
等倍のゲームでみられ、
games, simple puzzle games and when using
追加のカメラを
an additional camera for rendering UI elements
ゲームビューの上に
on top of the game view, like mini
UI 要素をレンダリングする必要がある
maps or heads-up displays.
ミニマップやヘッドアップディスプレイの場合に使用されます。
To control what is being rendered in our
シーンの中に何がレンダリングされるか制御するために
scenes, adjust the near and far clipping
ニアおよびファー クリッピング プレーン、
planes and the size or shape of the frustum.
および Frustum のサイズや形を調整して下さい。
Field Of View controls how wide the view
Field Of View によりカメラのビューの幅を
of the camera will be. This is very much
制御します。これは現実世界のカメラで
like using the zoom on a real world camera.
ズームを使用する場合などに使用できます。
When the camera is in orthographic mode
カメラが Orthographic モードにある場合、
size replaces the field of view property.
Size により Field Of View プロパティを置き換えます。
This controls the size of the
これにより Orthographic ビューポートのサイズを
orthographic viewport.
制御します。
This is similar to field of view but
これは Field Of View に似ていますが、
the value of the size property changes
Size プロパティの値は
the size of both the front and back planes
前や後ろのプレーンのサイズを同時に変化させます。
at the same time as there is no perspective
これは Orthographic カメラでは
with an orthographic camera.
パース(遠近法)がかからないためです。
Our scenes must have some sort of a background.
シーンには何らかの背景が必要です。
This controlled by the Clear Flags and
これは Clear Flags および
Background properties.
Background プロパティにより制御されます。
The colour values set in the background
Background プロパティでセットされた
property will be what's drawn behind any
Color の値は、もし他の設定が何も変更されない場合は
of the objects in our scene, if no other
シーンの中でオブジェクトの後ろに描画されるものと
settings have been changed. This is the
なります。これはデフォルトでは
default blue colour we see in a new empty scene.
空のシーンの背景にみえる青色となります。
Clear Flags determines what the background
Clear Flags によりカメラの背景が
will be for a camera. This setting is particularly
決定されます。この設定は
important when using multiple cameras.
複数のカメラを使用するときに特に重要です。
Each camera stores colour and depth information
各々のカメラはそのビューをレンダリングするときに
when it renders it's view. The portions of the
Color および Depth の情報を格納します。シーンのうち
screen that are not drawn upon are considered empty.
描画されない部分は空と判断されます。
The Clear Flags property will determine
Clear Flags プロパティにより
what is shown in this empty space.
空のシーンで何が描画されるかを判断します。
If we have a skybox set in our render
もし Skybox がレンダリング設定でセットされている場合
settings the background will be a skybox.
背景は Skybox となります。
Skybox is the default clear flag for any camera.
Skybox は全てのカメラにおいて デフォルトで Clear Flag となっています。
A skybox is a material that contains
Skybox とは複数の画像を含む
several images that surround the entire scene
マテリアルであり、シーン全体を囲んで
providing a textured background for that scene.
シーンにおけるテクスチャの背景となります。
For more information on skyboxes and
Skybox および レンダリング設定については
render settings see the appropriate lessons.
該当するレッスンを参照して下さい。
If we don't have a skybox set, or we choose
もし Skybox をセットしてない場合、または
solid colour as our clear flag.
Solid Color を Clear Flag として選択した場合、
The colour value from the background property
Background プロパティの Color の値が
will be used behind any of our objects
シーンにある
in the scene.
全てのオブジェクトの背景として使用されます。
Depth Only is primarily used for
Depth Only は主に
multiple cameras. We will cover depth only
複数のカメラの場合に使用されます。 Depth Only については
in a moment.
もう少し後で解説します。
Don't Clear will result in each frame
Don't Clear の場合は、各々のフレームが
being drawn over the last, creating
その直前のものの上に描画され、
a smear effect. This setting isn't typically
滲みのエフェクトが得られます。この設定は
used in games.
ゲームでの使用はあまり一般的ではありません。
When using multiple cameras the most practical
複数のカメラを使用するとき、もっとも実用的な
setting for clear flags is depth only.
Clear Flags の設定は Depth Only です。
With this setting each camera is given a
この設定により各々のカメラは
value and depth and the contents of each
値が与えられ、
camera's view are layered on top of each other
カメラのビューにおける各々のコンテンツおよび Depth は
in depth order, starting with
Depth の昇順で
lowest depth first.
互いに重なります。
Normally the main camera is assigned
通常はメイン カメラは
the lowest depth value
もっとも小さい Depth の値を割り当てます。
and has it's clear flag set to either
さらに Clear Flag を
skybox or solid colour.
Skybox または Solid Color とします。
All of the other cameras have their clear
他の全てのカメラは Clear Flags を
flags set to depth only. This way there is
Depth Only にセットします。これにより
one ultimate background, and the images
背景は究極的にひとつしかなく、
of all the other cameras are
全ての他のカメラの画像は
layered on top of the main camera.
このメインカメラの上にレイヤーされます。
The content of what the camera is rendering
カメラがレンダリングしているコンテンツは
is limited by the Culling Mask property.
Culling Mask プロパティにより制限されます。
The Culling Mask drop down will list
Culling Mask ドロップダウンにより
all the layers available in the scene.
シーンで利用可能なすべてのレイヤーをリストします。
The camera will render only those objects
カメラは Culling Mask で選択されたレイヤーにあるオブジェクトのみ
on the layers selected in it's culling mask.
レンダリングします。
For more information on layers and how to
レイヤーに関する詳細および使用方法については
use then see the appropriate lesson.
対応するレッスンを参照して下さい。
In the case of the User Interface overlay
ユーザインタフェースを重ねる場合、
we have the interface element set to the
UI 要素は UI レイヤーにセットして
UI layer. Our UI camera has it's culling mask
います。UI カメラは Culling Mask を
set to render only the objects on the User Interface layer
UI レイヤーのオブジェクトのみレンダリングするようにセットしています。
We have our clear flag set to depth only
Clear Flags は Depth Only にセットして
and the depth set to the highest value
さらに Depth はシーンにおける全てのカメラのうち
of all the cameras in the scene.
もっとも高い値にセットしています。
This way the UI camera only draws
これにより UI カメラは
the UI element based on the culling mask
UI 要素を Culling Mask 設定にのみもとづいて描画して
setting and the UI element draws on top
UI 要素は他の全てのレイヤーの上に
of all of the other layers, based on the depth.
Depth の順に描画します。
It is also worth noting that the camera is set to
覚えておくべき点として、カメラは
orthographic to remove any possible
Orthographic ビューにセットしてあり、
perspective on the UI element.
UI 要素にパースがかかることを避けています。
Typical uses of multiple cameras
複数のカメラを使用する
are to render UI elements like
典型的な用途は UI 要素のレンダリングであり、
mini maps or heads-up displays over the
ミニマップやヘッドアップディスプレイを
world view, make rear-view mirrors and
ワールド座標空間のビューに重ねて表示したり、ミラーとしてバック側を表示したり、
missile cameras, or to force the drawing order
ミサイルのカメラや、シーンにおけるオブジェクトの描画順を
of objects in the scene, like making
強制的に決める場合に使用し、
sure that a gun in a first person shooter
First Person Shooter における銃が
doesn't get drawn inside the level geometry.
レベルにおける他のオブジェクトの中に描画されないようにするなどの場合があります。
The normalised viewport rect, render path,
他のプロパティである Normalized Viewport Rect, Render Path,
target texture and HDR properties
Target Texture および HDR などは
are more advanced and will be covered in an other lesson.
より上級者向けであるため別のレッスンで解説します。 (翻訳:gamesonytablet)