材质
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.材质是一组属性(状态,选项,参数)和资源(2D,3D纹理),在文本文件中描述并与特定的对象表面相关联。
UNIGINE has its own material system that includes:UNIGINE拥有自己的材质系统,包括:
- Base materials implemented by programmers.程序员实施的基础(base)材质。
- User materials inherited from the base materials and adjusted via Materials Editor by 3D artists.从基础材质继承的用户(user)材质,并由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 are written in HLSL and PS5's 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.着色程序以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 runtime material that is not saved on a disk. When cloning or inheriting a material, each new material becomes internal until it is saved to a file.内部材质是没有名称的材质。克隆或继承材质时,每个新材质都是内部的,直到保存到文件中。
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 Editor
- 材质示例
- Blackbody 示例
- Blend By Height 示例
- Boiling 示例
- Cubemap Texture 示例
- Custom Code 示例
- Custom Subgraphs 示例
- Displacement 示例
- Dissolve 示例
- Energy Shield 示例
- Fade By Depth 示例
- Fresnel Effect 示例
- Glass 示例
- Hair Shading 示例
- Ice 示例
- Interior Mapping 示例
- Loop 示例
- Melting 示例
- Multi-Layered Material 示例
- Normal From Height Texture 示例
- Normal From Height Value 示例
- Object-Space Normal Map 示例
- Tangent-Space Normal Map 示例
- Panner 示例
- Portals 示例
- Procedural Tiles 示例
- Rain 示例
- Ramp Texture 示例
- UV Tiling and Offset 示例
- Vertex Animation 示例
- Vertex Color 示例
- Reparent to Graph Material
- 材质示例
- Material Nodes Library
- Miscellaneous
- Material Node
- Final Node
- To Int Node
- Portal In Node
- Portal Out Node
- Expression Node
- Function Node
- Sub Graph Node
- Loop Begin Node
- Loop End Node
- Rotate Space Node
- Transform Space Node
- Reflect Node
- Refract Node
- Time Node
- Rotate UV Node
- Compose Float2 Node
- Compose Float3 Node
- Compose Float4 Node
- Compose Int2 Node
- Compose Int3 Node
- Compose Int4 Node
- Compose Float By Exponent Node
- Decompose Float By Exponent Node
- Color Saturation Node
- Contrast Node
- Flowmap Panner Node
- Flowmap Panner Simple Node
- Levels Node
- Posterize Node
- RGB To Luma Node
- HUE To RGB Node
- RGB To HCV Node
- RGB To HSV Node
- HSV To RGB Node
- RGB To HCY Node
- HCY To RGB Node
- RGB To HCL Node
- HCL To RGB Node
- RGB To HSL Node
- HSL To RGB Node
- RGB To YUV Node
- YUV To RGB Node
- RGB To YCbCr Node
- YCbCr To RGB Node
- RGB To YCgCo Node
- YCgCo To RGB Node
- Overlay Node
- Srgb Node
- Srgb Inverse Node
- Screen UV To View Direction Node
- Position to Screen UV Node
- Fast Position To Screen Uv Node
- Depth To Position Node
- Reorient Normal Blend Node
- Reorient Vector Blend Node
- Normal Reconstruct Z Node
- Position to Normal Node
- Specular to Metalness Node
- Calc Mip Level Node
- Calculate TBN Node
- Normalization TBN Node
- Normal To TBN Node
- Parallax Occlusion Mapping Node
- Parallax Simple Node
- Face Forward Node
- Vertex Interpolation Node
- Pack Unit Vector To Octahedron Node
- Unpack Octahedron To Unit Vector Node
- Pack 1212 To 888 Node
- Pack 888 To 1212 Node
- Pack 88 To 16 Node
- Pack 16 To 88 Node
- Pack 44 To 8 Node
- Pack 8 To 44 Node
- Pack 1616 To 8888 Node
- Pack 8888 To 1616 Node
- Refraction Simple For Thick Objects Node
- Refraction Screen UV Offset For Thick Objects Node
- Refraction Simple For Thin Objects Node
- Refraction Screen UV Offset For Thin Objects Node
- Refraction Raymarched Node
- Reflection Simple Node
- Reflection Raymarched Node
- HDRI Raymarched Node
- SSAO Raymarched Node
- SSGI Raymarched Node
- Specular Ambient Occlusion Node
- Screen Space Subsurface Scattering Node
- Triplanar Color Node
- Triplanar Normal Node
- Blend By Height Node
- Blend By Height Simple Node
- Tiling and Offset Node
- Normal From Height Value Node
- Normal From Height Texture Node
- Depth Fade Node
- Interior Mapping Texture 2D Node
- Interior Mapping Cubemap Node
- Blackbody Node
- Fresnel Node
- Fresnel PBR Node
- Tree Animation Node
- Grass Animation Node
- Animation Time Node
- Animation Old Time Node
- Get Vector From Basis Node
- Angle Between Vectors Node
- Flipbook Node
- Anisotropic Specular Brdf Node
- Hair Shading Node
- Curvature Node
- Ggx Brdf Importance Sampling Node
- Replace Color Node
- Float Correction By Ramp Node
- Color Correction By Ramp Node
- Mirror UV Node
- Material Quality Switch Node
- Input
- Is Auxiliary Pass Node
- Is GBuffer Pass Node
- Is Shadow Pass Node
- Is Baking GI Node
- Is Lightmap Node
- Is Front Face Node
- View Direction Node
- Camera Direction Node
- Camera Offset Node
- Camera Position Node
- Camera Near Node
- Camera Far Node
- Camera INear Node
- Camera IFar Node
- Matrix Projection Node
- Matrix IProjection Node
- Matrix Camera Projection Node
- Matrix Camera IProjection Node
- Matrix Modelview Node
- Matrix IModelview Node
- Matrix Old Modelview Node
- Matrix Old IModelview Delta Node
- Matrix Old IModelview Node
- Oblique Frustum Plane Node
- Screen Resolution Node
- Screen IResolution Node
- Screen Coord Node
- Screen Coord Before Upscale Node
- Upscale Factor Node
- Screen UV Node
- Vertex Tangent Node
- Vertex Binormal Node
- Vertex Normal Node
- Vertex Color Node
- Vertex Position Node
- Vertex Depth Node
- Vertex UV 0 Node
- Vertex UV 1 Node
- Vertex ID Node
- Instance ID Node
- Material Mask Node
- Up Node
- Down Node
- Forward Node
- Back Node
- Right Node
- Left Node
- Vertex Front Face Node
- Object Position Node
- Object Scale Node
- Sun Direction Node
- Moon Direction Node
- Float Node
- Float2 Node
- Float3 Node
- Float4 Node
- Color (Float3) Node
- Color (Float4) Node
- Int Node
- Int2 Node
- Int3 Node
- Int4 Node
- Bool Node
- Frame Node
- IFps Node
- Game Scale Node
- Settings Nodes
- Parameters
- Bool Parameter Node
- Combobox Parameter Node
- Static Int Parameter Node
- Color Parameter Node Parameter Node
- Float Parameter Node
- Float2 Parameter Node
- Float3 Parameter Node
- Float4 Parameter Node
- Group Parameter Node
- Int Parameter Node
- Int2 Parameter Node
- Int3 Parameter Node
- Int4 Parameter Node
- Slider Parameter Node
- Texture2D Parameter Node
- Texture2DArray Parameter Node
- Texture2DInt Parameter Node
- Texture3D Parameter Node
- TextureCube Parameter Node
- TextureRamp R Parameter Node
- TextureRamp RG Parameter Node
- TextureRamp RGB Parameter Node
- TextureRamp RGBA Parameter Node
- Logical
- Decal-Related
- Math
- Add Node
- Subtract Node
- Multiply Node
- Frac Node
- DDX Node
- DDX Coarse Node
- DDX Fine Node
- DDY Node
- DDY Coarse Node
- DDY Fine Node
- DDXY Node
- Clamp Node
- Saturate Node
- Power Node
- Ceiling Node
- Floor Node
- Absolute Node
- Sign Node
- Base-E Logarithm Node
- Base-2 Logarithm Node
- Base-10 Logarithm Node
- Base-2 Exponential Node
- Base-E Exponential Node
- Increment Node
- Decrement Node
- Mod Node
- FMod Node
- Divide Node
- Divide Int Node
- Reciprocal Node
- Maximum Node
- Maximum Possible Float Node
- Maximum Possible Half Node
- Maximum Possible Int Node
- Minimum Node
- Minimum Possible Float Node
- Minimum Possible Int Node
- Rerange Node
- Square Root Node
- Reciprocal Square Root Node
- Round Node
- Multiply And Add Node
- ModF Node
- Step Node
- Smooth Step Node
- Length Node
- Length Squared Node
- Normalize Node
- Cross Node
- Dot Product Node
- Lerp Node
- Lerp3 Node
- Lerp Contrast Preserving Node
- Inverse Lerp Node
- Golden Ratio Node
- Pi Node
- Pi2 Node
- Pi05 Node
- Reverse Bits Node
- Is Finite Node
- Is Infinity Node
- Is Nan Node
- All Node
- Any Node
- First Bit High Node
- First Bit Low Node
- Distance Node
- Matrix
- Matrix2 Node
- Compose Matrix2 By Column Node
- Compose Matrix2 By Row Node
- Compose Matrix3 Node
- Compose Matrix3 By Column Node
- Compose Matrix3 By Row Node
- Compose Matrix4 Node
- Compose Matrix4 By Column Node
- Compose Matrix4 By Row Node
- Get Matrix Column Node
- Get Matrix Row Node
- Get Matrix Value Node
- Set Matrix Column Node
- Set Matrix Row Node
- Set Matrix Value Node
- Is Ortho Node
- Basis X Node
- Basis Y Node
- Basis Z Node
- Determinant Node
- Orthonormalize Node
- Scale Node
- Translate Node
- Transpose Node
- Inverse Node
- Inverse Transform Node
- Decompose Euler Node
- Rotate Euler Node
- Rotate Axis Node
- Rotate X Node
- Rotate Y Node
- Rotate Z Node
- Decompose Transform Node
- Compose Transform Node
- Matrix Multiply 3x3 Node
- Matrix Multiply 4x4 Node
- Ortho Node
- Frustum Node
- Perspective Node
- Cube Transform Node
- Matrix Object To Absolute World Node
- Matrix Object To Camera World Node
- Matrix Object To View Node
- Matrix View To Object Node
- Matrix View To Absolute World Node
- Matrix View To Camera World Node
- Matrix Absolute World To View Node
- Matrix Absolute World To Object Node
- Matrix Camera World To View Node
- Matrix Camera World To Object Node
- Trigonometry
- Textures
- Light Map Texture Node
- Surface Custom Texture Node
- Texture 2D Node
- Texture 2D Array Node
- Texture 2D Int Node
- Texture 3D Node
- Texture Cube Node
- Sample Texture Node
- Texture Resolution Node
- Texture Buffer GBuffer Albedo Node
- Texture Buffer GBuffer Normal Node
- Texture Buffer GBuffer Shading Node
- Texture Buffer GBuffer Velocity Node
- Texture Buffer Curvature Node
- Texture Buffer Auxiliary Node
- Texture Buffer Depth Node
- Texture Buffer Depth Opacity Node
- Texture Buffer Depth Opacity Fast Node
- Texture Buffer Direct Lights Node
- Texture Buffer Indirect Lights Node
- Texture Buffer Indirect Diffuse Final Node
- Texture Buffer Indirect Specular Final Node
- Texture Buffer Screen Color Node
- Texture Buffer Screen Color Old Node
- Texture Buffer Screen Color Old Reprojection Node
- Texture Buffer Screen Color Opacity Node
- Texture Buffer Clouds Screen Node
- Texture Buffer GBuffer Material Mask Node
- Texture Buffer Normal Fast Node
- Texture Buffer Refraction Node
- Texture Buffer Refraction Mask Node
- Texture Buffer SSAO Node
- Texture Buffer SSGI Node
- Texture Buffer SSR Node
- Texture Buffer Transparent Blur Node
- Texture Buffer Auto Exposure Node
- Texture Buffer Auto White Balance Node
- Texture Buffer Bent Normal Node
- Texture Buffer DOF Mask Node
- Texture Ramp R Node
- Texture Ramp RG Node
- Texture Ramp RGB Node
- Texture Ramp RGBA Node
- Procedural
- Miscellaneous
- 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