To draw something in Unity, you must provide information that describes its shape, and information that describes the appearance of its surface. You use meshes to describe shapes, and materials to describe surfaces.
Materials and shaders are closely linked. In Unity, a material contains a reference to a Unity shader, and data (such as colors or textures) that the Unity shader uses. You use materials and Unity shaders together to define the appearance of surfaces in your scene.
本页包含以下信息:
功能 | 内置渲染管线 | 通用渲染管线 (URP) | 高清渲染管线 (HDRP) | 自定义可编程渲染管线 (SRP) |
---|---|---|---|---|
材质 | 是 | 是 | 是 | 是 |
A material contains a reference to a Unity shader. It can also contain data for the Unity shader, such as textures or colors.
The Material class represents a material in C# code. For information on using the Material
class, see Using Materials with C# scripts.
A material asset represents a material in your Unity project. If the Unity shader assigned to a material asset defines material properties, then the data for those properties is saved as part of the material asset. This means that you can view and edit material properties using the Inspector window. For information on viewing and editing a material using the Inspector window, see Material Inspector reference.
使用材质渲染游戏对象:
Renderer
继承的组件。MeshRenderer 是最常见的,适用于大多数用例,但如果游戏对象有特殊要求,SkinnedMeshRenderer、LineRenderer 或 TrailRenderer 可能更合适。使用材质渲染内置粒子系统中的粒子系统: