用料
A material is a set of properties (states, options, parameters) and assets (2D, 3D textures), described in a text file and associated with a particular object surface.material是一组属性(状态,选项,参数)和资产(2D,3D纹理),在文本文件中描述并与特定的对象表面相关联。
UNIGINE has its own material system that includes:UNIGINE拥有自己的材料系统,包括:
- Base materials implemented by programmers.程序员实施的基础(user)材料。
- User materials inherited from the base materials and adjusted via Materials Editor by 3D artists.从基础材料继承的用户(base)材料,并由3D艺术家通过“材料编辑器”进行了调整。
Base Materials基础材料#
A base material stores a set of material properties and refers to fragment, vertex and geometry shaders, describing how the material will look like.基础材料存储一组材料属性,并引用片段,顶点和几何shaders,描述了材料的外观。
Shaders are written in GLSL and HLSL shading languages. In UNIGINE, there is also the Unified UNIGINE shader language (UUSL) that also can be used to write shaders: it allows creating a single shader file for both 3D graphics APIs: OpenGL and Direct3D11.着色器以GLSL和HLSL着色语言编写。在UNIGINE中,还有统一UNIGINE着色器语言(UUSL)也可用于编写着色器:它允许为两个3D图形API(OpenGL和Direct3D11)创建单个着色器文件。
The base material is stored in the *.basemat file. It cannot be edited via Materials Editor: to customize the base material, you should directly edit the text file. Or you can create a brand new one.基础材料存储在*.basemat文件中。不能通过材料编辑器对其进行编辑:要自定义基础材料,您应直接编辑文本文件。或者,您可以创建一个全新的链接。
The base materials cannot form materials hierarchy: no base material can be inherited from another base material. The base material is always on the top of the hierarchy: user materials are inherited from it.基础材料无法形成材料层次结构:不能从其他基础材料继承任何基础材料。基础资料始终位于层次结构的顶部:用户资料是从其继承的。
A set of built-in base materials is quite big and contains most of the frequently asked materials.一组内置基础材料很大,其中包含大多数常见问题的材料。
User Materials用户资料#
A user material overrides properties sent to shaders used by the base material from which the user material (or its parent) is inherited. The user material itself cannot refer to a shader.用户材质会覆盖发送给材质的着色器的属性,该材质由继承用户材质(或其父级)的基础材质使用。用户资料本身不能引用着色器。
The user material is stored in the *.mat file that contains references to the parent and the base materials. Such file is usually created when inheriting a new material from the base one or the other user material via Materials Editor. The user material cannot be customized: a set of user material properties cannot differ from properties of the referred base material. However, you can edit the user material via Materials Editor.用户资料存储在*.mat文件中,该文件包含对父级和基础资料的引用。通常,当通过“材质编辑器”从基础材质或其他用户材质继承新材质时,会创建此类文件。用户材料无法自定义:一组用户材料属性不能与引用的基础材料的属性不同。但是,您可以通过“材料编辑器”编辑用户材料。
Unlike base materials, user materials can form materials hierarchy.与基础资料不同,用户资料可以构成资料层次结构。
Manual and Internal Materials手册和内部材料#
In UNIGINE, there are also manual materials. Such materials are created and edited manually: changes made via Materials Editor at run-time cannot be saved. All base materials (both the built-in and the custom ones) are manual. However, not every manual material is the base one: the user materials can be manual too.在UNIGINE中,还有手册资料。此类材料是手动创建和编辑的:在运行时通过材料编辑器进行的更改无法保存。所有基础材料(内置材料和自定义材料)都是手动的。但是,并非每种手册资料都是基础资料:用户资料也可以是手册。
In the *.mat file, the manual user material name is stored. The child *.mat files can store name-based or GUID-based reference to the parent manual material.在*.mat文件中,存储了手动用户材料名称。子*.mat文件可以存储基于基于名称或基于GUID的对父手册材料的引用。
The manual material is implemented by programmers when it is necessary to create a material without using Materials Editor.当需要在不使用“材料编辑器”的情况下创建材料时,程序员可以使用手动材料。
An internal material is a material without a name. When cloning or inheriting a material, each new material becomes internal until a name is assigned to it.内部材料是没有名称的材料。克隆或继承材质时,每个新材质都将成为内部材质,直到为其分配了名称。
See Also也可以看看#
- Hierarchy and Inheritance article to know more about how materials are organized. 层次结构和继承 文章可了解有关材料组织方式的更多信息。
- Materials GUIDs article to know how to refer the base and user materials. 材料GUID 文章,了解如何引用基础资料和用户资料。
- Materials Files section to know more about the base and user materials, the .mat and .basemat files and their connection with shader files. 材料文件 部分,以了解有关基础材料和用户材料,.mat和.basemat文件及其与着色器文件的连接的更多信息。
- Custom Materials article to know basics of a new material creation. 自定义材料 文章了解新材料创建的基础。
- Unified Unigine Shader Language article to know how to implement a shader file for both 3D graphics APIs. 统一的Unigine着色器语言 文章,了解如何为两个3D图形API实现着色器文件。
本節中的文章
- Material Library
- billboards_base
- billboards_cloud_base
- billboards_impostor_base
- clouds_base
- decal_base
- decal_terrain_hole_base
- grass_base
- grass_impostor_base
- gui_base
- landscape_terrain_base
- landscape_terrain_detail_base
- mesh_base
- particles_base
- render_composite
- sky_base
- terrain_global_base
- volume_cloud_base
- volume_fog_base
- volume_light_base
- volume_omni_base
- volume_proj_base
- volume_shaft_base
- water_global_base
- water_mesh_base
- Postprocess Materials
- Debug Materials