Material 材质
Materials are used in conjunction with Mesh or Particle Renderers attached to the GameObject. They play an essential part in defining how your object is displayed. Materials include a reference to the Shader used to render the Mesh or Particles, so these Components can not be displayed without some kind of Material.
some kind of Material. 材质(Materials)用来把网格(Mesh)或粒子渲染器(Particle Renderers)贴到游戏对象上。他们在定义对象怎么被显示发挥重要组成部分。材质包括用于呈现网状或颗粒着色器的参考,所以这些组件不能在没有材质的情况下显示。
A Diffuse Shader Material has only two properties - a color and a texture.
漫反射着色器材质只有两个属性 - 颜色和纹理。
Properties 属性
The properties of any Material will change depending on the selected Shader. These are the most often used properties:
任何材质的属性取决于选定的着色器(Shader)发生变化。这是最常用的属性:
- Shader 着色器 The Shader that will be used by the Material. For more information, read the Built-in Shader Guide.
将被材质(Material)使用的着色器。有关更多信息,请阅读内置的着色指南(Built-in Shader Guide)。 - Main Color 主颜色 Any kind of color tint can be applied. Use white for no tint.
任何一种色调都可使用。不填色就使用白色。 - Base 基本 The Texture that will be displayed. 将被显示的纹理
Details 详情
Materials are used to place Textures onto your GameObjects. You cannot add a Texture directly without a Material, and doing so will implicitly create a new Material. The proper workflow is to create a Material, select a Shader, and choose the Texture asset(s) to display along with it. For more information on Materials, take a look at the Manual's page about Materials.
材质是用来放置纹理(Textures)到你的游戏对象。您不能在没有材质的情况下直接增加纹理,这样做会隐式地创建一个新的材质。正确的工作流程是创建一个材质,选择一个着色器,并选择纹理资源(s),以一并显示。更多关于材质的信息,看手册材质(Materials)页。
Choosing Shaders 选择着色器
After you create your material, the first thing you should decide is which Shader to use. You choose it from the drop-down Shader menu.
您创建您的材料后,第一件事情,你应该决定使用的着色器。您可以从着色器下拉菜单选择。
The Shader drop-down menu 着色器下拉菜单
You can choose any Shader that exists in your project's assets folder or one of the built-in Shaders. You can also create your own Shaders. For more information on using the built-in Shaders, view the Built-in Shader Guide. For information on writing your own shaders, take a look at the Shaders section of the Manual and ShaderLab Reference.
您可以选择任何在您的项目资源文件夹存在的着色器或一个内置的着色器。您还可以创建你自己的着色器。使用内置的着色器的详细信息,查看内置着色器指南(Built-in Shader Guide)。关于写自己的着色器更多信息,看看参考手册着色器部分(Shaders)和 ShaderLab Reference。
Setting shader properties 设置着色器属性
Depending on the type of shader selected, a number of different properties can appear in the Inspector.
根据选择的着色器类型,在检视面板会出现许多不同的属性。
Properties of a Specular shader 高光(Specular)着色器的属性
Properties of a Normal mapped shader 法线贴图着色器属性
Properties of a Normal mapped Specular shader 法线贴图高光高光着色器。
The different types of Shader properties are:
不同类型的着色器的属性是:
- Color pickers 颜色选取器 Used to choose colors. 用来选择颜色
- Sliders 滑动条 Used to tweak a number value across the allowed range.
用于在整个允许的范围内调整的一个数值。 - Textures 纹理 Used to select textures. 用于选择纹理
Texture placement 纹理布置
The placement of the textures can be altered by changing the Offset and Tiling properties.
纹理的位置可以改变,通过改变偏移(Offset)和平铺(Tiling)属性。
This texture is tiled 2x2 times by changing the Tiling properties
这个纹理是通过改变平铺属性平铺2 × 2倍
- Offset 偏移 Slides the Texture around. 滑动纹理
- Tiling 平铺 Tiles the Texture along the different axes. 沿着不同的轴,平铺纹理
Hints 提示
- It is a good practice to share a single Material across as many GameObjects as possible. This has great performance benefits.
这是一个很好的做法,尽可能多的游戏物体之间共享一个材质。这具有很大的性能优势。