字幕表 動画を再生する
Materials in Unity are the assets that control
Unity におけるマテリアルとは
the visual appearance of game objects.
ゲームオブジェクトの視覚的な見え方を制御するアセットです。
Applied to a renderer component,
レンダラ(Renderer) コンポーネントに適用すると
the material is essentially an asset
マテリアルとは要するに
that brings together a shader, a script
シェーダという、描画された
that controls the appearance of a rendered surface
表面の見え方や、色、テクスチャのような必要なプロパティの
and it's required properties, such as
コントロールをするスクリプトを
colours and textures.
まとめるのに必要なアセットです。
Materials can be made by using the
マテリアルを作成するには
Create button on the project panel.
プロジェクトパネルの Create ボタンを使用します。
And once you've created this asset
このアセットを作成した後は
it can be assigned to a renderer component
レンダラ コンポーネントにアサインして
and a shader can be chosen from the drop down list.
ドロップダウン リストからシェーダを選ぶことが出来ます。
Materials can also be generated from
3D パッケージからもってきたモデルから
models brought in from 3D packages
マテリアルを生成することもできますが
but we will discuss this later.
これについては後で説明します。
As a basic example
基本的な例として、
if we have a primitive cube in Unity
Unity においてプリミティブであるキューブがあり、
and an example material ready to use on it
その上で使用するサンプルのマテリアルがある場合
we can assign this to the mesh renderer.
これをメッシュ レンダラに割り当てることができます。
The mesh renderer is the component used
メッシュレンダラ とはあらゆる 3D メッシュを
to render any 3D mesh.
レンダリングするのに使用するコンポーネントです。
We'll assign this to the materials slot.
これをマテリアル スロットに割り当てます。
By default a primitive mesh has
デフォルトではプリミティブ メッシュには
Unity's default-diffuse material assigned to it.
Unity のデフォルトである Diffuse マテリアルが割り当てられています。
We will replace this with our example material.
次にこれをサンプルのマテリアルで置き換えます。
Whilst I have assigned this material
このマテリアルをアサインするために
by dragging it directly to the material's property
マテリアルのプロパティに直接ドラッグしますが、
I could also assign it by dragging it to the model
別の方法として、モデルの上にドラッグしたり
or dropping it in to the scene.
シーン上にドロップすることができます。
And you can see that Unity previews what that
Unity のプレビューにより
material would look like on the mesh
ドロップしているメッシュ上でマテリアルが
that we're dropping on to.
どのようにみえるか確認できます。
Once assigned we see settings for this material
一回アサインすると、このマテリアルの設定を
below other components in the inspector.
インスペクタ上の他のコンポーネントの下で確認することが出来ます。
It's important to know that this part of the inspector's
インスペクタの設定のこの部分は
settings are simply a shortcut to editing
単に、マテリアル アセットを編集する場合のリンクでしかない
the material asset.
ことを理解すべきです。
This is important because when changing the
これが重要である理由は、
properties of a material on the object
オブジェクトのマテリアルのプロパティを変更するとき
you are actually changing the material asset itself.
実際にはマテリアル アセットそのものを変更しているからです。
For example if I make this material red.
例えば、もしこのマテリアルを赤にした場合
The asset has been made red.
アセットが赤になります。
So for example
つまり例えば
if I have a sphere
Sphere があったとして
and assign the same material
同じマテリアルを割り当てた場合
it too will be red.
これもまた赤になります。
And when adjusting that material on
そしてこのマテリアルをそれら二つのマテリアルのいずれかの上で
either of those two objects
調整するとき、
we're simply adjusting the asset so any object
アセットを調整していることになるので、
using that material will be changed too.
そのマテリアルを使用するオブジェクトもまた変更されます。
When introducing 3D assets from
モデリング アプリケーションから 3D アセットを
a modelling application Unity will create
導入するとき、 Unity は
the materials in a materials subfolder
アセットがある場所に、
in the location of the asset
Materials サブフォルダの中でマテリアルを作成し、
as well as assigning textures for you.
さらにテクスチャを自動的に割り当てます。
For example this blast door asset has been
例えば、この prop_blastDoor は
brought in to Unity and we have saved
Unityにインポートされたとき、
it's textures in to folder called Textures
Textures フォルダにテクスチャを保存してますが、
which Unity automatically searches
Unity は自動的にここを検索して
in order to reassign it to the material
Unity が自動的に作成するマテリアルに再度割り当てを
that it creates.
行ないます。
The two parts of the asset are the door
アセットの二つの部品はドアと
and the frame.
フレーム部分です。
Both of these assets share the same material
これらのアセットの両方は同じマテリアルを共有して
and simply use different parts of the texture
テクスチャの異なる部分を使用して
to render them.
レンダリングを行ないます。
The material that's being created is
作成されたマテリアルは
Prop_Blastdoor
prop_blastDoor であり、
and I can see that if I click on it
その上でクリックすれば確認することが出来ます。
it's highlighted in the project panel.
プロジェクトパネル上でハイライトされています。
As standard when introducing this
標準ではこれをインポートするとき
we would be shown a diffuse shader.
別の Diffuse シェーダが表示されます。
This is a flat standard look for
これは 3D メッシュをレンダリングするとき、
rendering 3D meshes.
平坦にみえる標準的な見え方です。
We have a normal map for this asset
このアセットにはノーマルマップがあるため、
so we can instead choose a bumped shader
その代わりに Bump Diffuse といった
such as Bump Diffuse
バンプ (Bumped) シェーダを使用して
to make use of this texture.
このテクスチャを活用することが出来ます。
The normal map is a way of storing
法線マップ (Normal Map) とは
height and directional information
高さや法線の向きといった情報を格納したうえで、
that is projected onto the surface
平らなメッシュの
of a flat mesh
表面にを投影して
in order to give it the appearance of
オブジェクトそのものに頂点データを加えることなく
surface detail without adding
表面にディテールを加えた見た目を
vertices to the geometry itself.
実現します。
And if you look at the mesh in the scene or
もしシーンビューまたはゲームビューの中で
game view you can see the difference
メッシュをみたとき
that this makes.
これらが生み出す違いが分かります。
So the dents, grooves and scratches
窪みや、溝、キズなどが
on our blast door are accentuated
blastDoor オブジェクト上でアクセントがついて
in the normal map texture.
法線マップのテクスチャ上で表現されます。
We could also extend this to give
さらにこれを拡張して
it a shiny surface by choosing
鏡のような表面を実現するのに
Bumped Specular.
バンプ鏡面 (Bumped Specular) を選択します。
Here, in addition to the texture and the normal map
ここでは、テクスチャおよび法線マップに加えて
we are also able to set the shininess.
Shininess (輝度)をセットできます。
So we've gone from our default flat look
これでデフォルトの平らな見た目から
to our nice shiny looking dented door
窪みがあり、輝きのあるドアが表現できるようになりました。
simply by adjusting the shader.
これはシェーダを調整するだけで実現できています。
We haven't had to add any more detail to the
元のモデルそのものに
original model, and that's the true power
ディテールを追加することなく、
of using materials.
マテリアルを使用することに価値はまさにここにあります。
Unity ships with many shaders that will
Unity は多くのシェーダが同梱されていて
cover all manner of game development needs
ゲーム開発の様々なニーズをこれでカバーすることが出来て、
and you can also write your own shaders
さらにカスタムのシェーダを書いたうえで
and assign them.
それらを割り当てることも出来ます。
You can create these also from using the
また、これらを作成するには
create button on the project panel.
プロジェクトパネルの Create ボタンを使用します。 (翻訳:gamesonytablet)