Vixen
dd8b0a81
csharp
public sealed class MaterialAsset

A material, as a .vxmat holds it.

Read the guide page for this →

Remarks

The authoring format, not MaterialDescriptor. The runtime's material is a tree of features with a shading model and a compiled pipeline; this is what a person edits and what git diffs, and turning one into the other is MaterialCompiler's job. ⚠ This paragraph used to add "the one doc 08 names and nothing has written", which is false and has been for some time: MaterialCompiler is in Vixen.Rendering, MaterialImporter runs it over every .vxmat to find out whether it is a material, and MaterialReflectionTests holds its predicted names against Raven's own reflection. The sentence outlived the gap it described, and was still being cited as the reason a shader graph could not draw.

Shading is a name, not a type. An IMaterialShading is a runtime object with a Compile method on it, and a document that named the type would be a document that cannot be read without loading the renderer. The compiler resolves the name against the shading models it has and reports one it does not know, which is a diagnostic an author can act on rather than a binder failure.

The version is written and is read, on SceneFile's terms: a file from a newer editor is refused by number rather than bound as far as it goes, because a material half-read is a material that will be saved back with the other half gone.

Fields and properties (9)

  • public const int Current

    The version this reader and writer speak.

  • public const string Extension

    What a material is written as.

  • public int Version

    Which version of the format this file is.

  • public string Shader

    Which shader it is drawn with.

  • public string Shading

    Which shading model, by the name the renderer registers it under.

  • public AssetId Graph

    The shader graph this material was authored in, if it was.

  • public List<IMaterialParameter> Parameters

    What it sets, in the order the file lists them.

  • public List<IMaterialFeature> Features

    The surface features, in the order they contribute.

  • public List<MaterialTexture> Textures

    The textures its features sample, by the names they sample them under.

Methods (3)

  • public static MaterialAsset FromYaml(string yaml)

    Reads YAML into a material.

  • public string ToYaml()

    Writes it as YAML.

  • public IMaterialParameter? Find(string name)

    The parameter of a given name, if it has one.

Used by (13)

  • BakedMaterialFileTestsVixen.Editor.AssetEditors.Tests
  • EditorApplicationVixen.Editor.App
  • EditorViewTestsVixen.Editor.AssetEditors.Tests
  • MaterialDocumentVixen.Editor.AssetEditors
  • MaterialEditorFactoryVixen.Editor.AssetEditors
  • MaterialGraphLinkTestsVixen.Editor.AssetEditors.Tests
  • MaterialGraphPropertyTestsVixen.Editor.AssetEditors.Tests
  • MaterialParameterCommandVixen.Editor.AssetEditors
  • MaterialTestsVixen.Editor.AssetEditors.Tests
  • MaterialViewVixen.Editor.AssetEditors
  • ShaderGraphSurfaceTestsVixen.Editor.App.Tests
  • TypeRegistrationVixen.Editor.AssetEditors
  • Vixen_Editor_AssetEditors_Materials_MaterialAssetSerializerVixen.Editor.AssetEditors