Materials
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.
UNIGINE has its own material system that includes:
- Base materials implemented by programmers.
- User materials inherited from the base materials and adjusted via Materials Editor by 3D artists.
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 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.
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.
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.
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.
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.
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.
- Materials Files section to know more about the base and user materials, the .mat and .basemat files and their connection with shader files.
- 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.
Articles in This Section
- Material Editor
- Material Samples
- Alpha Blend Sample
- Alpha Test Sample
- Boiling Sample
- Cubemap Texture Sample
- Custom Code Sample
- Custom Subgraphs Sample
- Displacement Sample
- Dissolve Sample
- Energy Shield Sample
- Fade By Depth Sample
- Fresnel Effect Sample
- Glass Sample
- Ice Sample
- Interior Mapping Sample
- Loop Sample
- Melting Sample
- Object-Space Normal Map Sample
- Tangent-Space Normal Map Sample
- Panner Sample
- Portals Sample
- Procedural Damage Sample
- Procedural Tiles Sample
- Rain Sample
- Simple PBR Material Sample
- UV Tiling and Offset Sample
- Vegetation Sample
- Vertex Color Sample
- Reparent to Graph Material
- Material Samples
- 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
- Compose Float3
- Compose Float4
- Compose Int2
- Compose int3
- Compose Int4
- Compose Float By Exponent
- Decompose Float By Exponent
- Color Saturation Node
- Contrast Node
- Levels Node
- Posterize Node
- RGB To Luma Node
- RGB To HCV Node
- RGB To HSL Node
- HSL To RGB Node
- Overlay Node
- Srgb Node
- Srgb Inverse Node
- Screen UV To View Direction Node
- Position to Screen UV 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
- Parallax Occlusion Mapping Node
- Parallax Simple Node
- Face Forward Node
- Vertex Interpolation Node
- Pack Unit Vector To Octahedron
- Unpack Octahedron To Unit Vector
- Pack 1212 To 888
- Pack 888 To 1212
- Pack 88 To 16
- Pack 16 To 88
- Pack 44 To 8
- Pack 8 To 44
- Pack 1616 To 8888
- Pack 8888 To 1616
- 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
- Triplanar Color Node
- Triplanar Normal Node
- Blend By Height 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
- Tree Animation Node
- Grass Animation 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 UV Node
- Vertex Tangent Node
- Vertex Binormal Node
- Vertex Normal Node
- Vertex Color Node
- Vertex Position 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
- 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
- Logical
- 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
- 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
- Compose Matrix3
- Compose Matrix3 By Column
- Compose Matrix3 By Row
- Compose Matrix4
- Compose Matrix4 By Column
- Compose Matrix4 By Row
- Get Matrix Column
- Get Matrix Row
- Get Matrix Value
- Set Matrix Column
- Set Matrix Row
- Set Matrix Value
- Is Ortho
- Basis X
- Basis Y
- Basis Z
- Determinant
- Orthonormalize
- Scale
- Translate
- Transpose
- Inverse
- Inverse Transform
- Decompose Euler
- Rotate Euler
- Rotate Axis
- Rotate X
- Rotate Y
- Rotate Z
- Decompose Transform
- Compose Transform
- Matrix Multiply 3x3
- Matrix Multiply 4x4
- Ortho
- Frustum
- Perspective
- Cube Transform
- Matrix Object To Absolute World
- Matrix Object To Camera World
- Matrix Object To View
- Matrix View To Object
- Matrix View To Absolute World
- Matrix View To Camera World
- Matrix Absolute World To View
- Matrix Absolute World To Object
- Matrix Camera World To View
- Matrix Camera World To Object
- Trigonometry
- Textures
- Light Map Texture Node
- Texture 2D Node
- Texture 2D Array 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 Lights Node
- Texture Buffer Depth Node
- Texture Buffer Depth Opacity Node
- Texture Buffer Depth Opacity Fast 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 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
- Procedural
- Miscellaneous
- Built-in Base Materials
- 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