# Material System Overview > **Notice:** The sections below cover advanced manual material development: material definitions, inheritance, and rendering integration. **The recommended way to create materials is through the visual, node-based [Material Editor](../../../content/materials/index.md), which provides an approachable workflow without writing material and shader code by hand.** A material combines a definition with a set of values. The definition describes available inputs and shader programs. Individual materials supply values for those inputs, such as a color, a roughness value, or a texture. ## Definitions and Values A **base material** defines the structure and behavior of a material family. It declares parameters, states, texture inputs, shader sources, and passes, together with their default settings. It also determines which types of geometry the material supports. A **derived material** uses that definition and overrides selected settings. Its immediate parent can be the base material or another derived material. Settings that are not overridden continue to come from the parent. Edit its values in the material settings in UnigineEditor. For example, one base material can describe how wooden surfaces are rendered. Two derived materials can use different wood textures and roughness values while keeping the same set of declared inputs and shader sources. Adding a new input or changing the calculations requires changing the base definition or its source graph. Derived materials share the base description while retaining their own settings and override information. See [Material Inheritance](../../../code/materials_shaders/inheritance/index.md) for more on parent relationships and overrides. ## Authoring a Base Material The [Material Editor](../../../content/materials/graph/index.md) lets you describe calculations by connecting graph nodes. Parameters exposed by the graph become settings of the resulting material. The graph is an authoring source: during import, the Editor generates a base material description and shader code for the Engine to use. For a new source-authored base material, use [ULON](../../../code/formats/materials_formats/ulon_base_material_format.md). The description declares settings and resources, and selects shader sources for its passes. Existing bases may use the legacy [XML format](../../../code/formats/materials_formats/base_material_format.md). The GPU calculations use [UUSL (Unified UNIGINE Shader Language)](../../../code/uusl/index.md#uusl_wtf), which builds on HLSL syntax. ## Source Files and Loaded Materials A file extension identifies a resource's role, but it does not describe the whole material hierarchy. In particular, a graph asset and its generated base material belong to the same authoring workflow. A derived material may use that base just as it uses a handwritten base. | File | Role | |---|---| | `*.abstmat` | A reusable ULON description incorporated into another material description. | | `*.basemat` | A base material description in ULON or XML. It may be handwritten or generated from a graph. | | `*.mat` | An XML description of a derived material and its overrides. See [User Material File Format](../../../code/formats/materials_formats/user_material_format.md). | | `*.mgraph` | The source of a material graph. Import generates a base material description and shader code. | | `*.msubgraph` | A reusable part of a graph, with inputs and outputs used by other graphs. | Once loaded, a material is an Engine object. Changing a value on that object and saving the change to an asset are separate operations. For programmatic access, the [Materials API](../../../api/library/rendering/class.materials_cpp.md) provides lookup and loading operations, while the [Material API](../../../api/library/rendering/class.material_cpp.md) provides access to individual materials and their settings. ## Reusing Material Descriptions An [abstract material](../../../code/materials_shaders/abstract_materials/index.md) supplies shared declarations and code for building base materials. For example, it can provide common parameters and shader code, leaving named code fragments for individual bases to supply. The abstract description becomes part of the base definition. A base can instead contain a complete definition without an abstract parent. This differs from creating a derived material. Incorporating an abstract description helps construct the available inputs and programs; a derived material chooses values within the resulting base definition. Reusing a subgraph is another mechanism: it shares graph calculations through the graph's inputs and outputs. Mesh and decal graphs use the standard abstract descriptions, while Post Effect graphs generate their own framework without inheriting *Unigine::post*. Built-in bases are not required to use an abstract description. ## Material Inputs and Programs The base description connects settings to shader calculations and rendering behavior. Some settings provide data, while others help select or prepare the program that uses it. | Part | Purpose | Example | |---|---|---| | [Parameters](../../../code/formats/materials_formats/ulon_materials/parameters.md) | Numeric inputs to calculations. | A color, roughness, or effect strength. | | [Textures](../../../code/formats/materials_formats/ulon_materials/textures.md) | Texture inputs with a specified source and sampling settings. | A file texture or an image supplied by rendering code. | | [States](../../../code/formats/materials_formats/ulon_materials/states.md) | Discrete settings used in conditions and shader definitions. | Enabling an additional calculation or selecting a mapping mode. | | [Options](../../../code/formats/materials_formats/ulon_materials/options.md) | Built-in settings used by rendering code and shader preparation. | Transparency, depth testing, or two-sided rendering. | | [Shader sources](../../../code/formats/materials_formats/ulon_materials/shaders.md) | Code used to build programs, including reusable code fragments. | Vertex processing or fragment color calculations. | | [Passes](../../../code/formats/materials_formats/ulon_materials/passes.md) | Named combinations of shader stages, with conditions and geometry-type selection. | Programs for drawing a surface into the G-buffer or a shadow map. | Changing a numeric parameter normally changes input data for the program. Changing a state can change conditions and shader definitions, selecting another program variant. That variant may already be cached; a state change does not necessarily require compiling a new program every time. ## How Rendering Uses a Material A material does not schedule the frame. The renderer decides which tasks to perform, which surfaces participate, and where to write their results. When drawing a surface, it requests a suitable shader program from the surface's material for the required pass and geometry type. For example, the same surface can participate in a G-buffer operation and in shadow-map rendering. Its material provides programs for these different tasks. A post-effect instead processes an existing image, with rendering code supplying its input textures and output target. A renderer stage can use several material passes, and the same pass name can be used in different stages or views. The built-in name *post*, for example, is used by service materials for lighting and buffer processing as well as post-effects. See the [Rendering Sequence](../../../principles/render/sequence/index.md) for the order of rendering tasks. Shader compilation prepares GPU programs; the material still supplies settings and resources during rendering. Two materials can use the same compiled program with different textures and parameter values. Creating a base material or declaring a pass alone does not arrange a call to that pass. [Scriptable materials](../../../content/materials/scriptable.md) can execute UnigineScript expressions at supported rendering callbacks. Such an expression can supply resources and explicitly run named passes, as needed for an effect that performs several operations. ## Choosing the Next Step - To create or change graph calculations, use the [Material Editor](../../../content/materials/graph/index.md) guide. - For a first source-authored mesh base, follow [Creating a Base Material](../../../code/materials_shaders/creating_base_material/index.md). - To build a base from shared declarations and shader code, start with [Abstract Materials](../../../code/materials_shaders/abstract_materials/index.md). - For declaration syntax, use the [ULON format reference](../../../code/formats/materials_formats/ulon_base_material_format.md). To inspect existing legacy descriptions, use the [XML format reference](../../../code/formats/materials_formats/base_material_format.md).