Vixen
dd8b0a81
csharp
public record class GraphSurfaceFeature

A surface authored as a shader graph rather than chosen from the library.

Read the guide page for this →

Remarks

The end of the graph story, and it needed no new machinery to be. A shader graph compiled to Raven and nothing consumed it, because the shape it emitted — a whole shader with its own transforms and its own stages — is one nothing in this engine can put on a mesh. Master/Surface emits an IMaterialSurface instead, and an IMaterialSurface is precisely what a feature names. So a graph-authored material is a material with one more feature in its list, composed into CompositeSurface beside MetalRoughnessFeature, and everything after that — the effect key, the parameter block, the lighting, the shadows, the bindless table — is the path every other material already takes.

⚠ The one thing this has that no other feature does is a ShaderName it does not know at compile time. Every hand-written feature returns a constant, because the shader it names is a file somebody committed; this one names a shader a build generated from a .vxshadergraph, so the name is data. That is also the only way this can be wrong in a way nothing catches: a material naming a graph whose shader was never compiled resolves to an effect miss, which is a draw that does not happen.

It carries values and names, and no handle — "materials are values, not resources", as IMaterialFeature puts it. Maps is a pairing of names, and what turns one into something a shader can index is a host with a BindlessTable; see TextureIndices.

Fields and properties (5)

  • public string Shader

    The shader the graph compiled to, which is the graph's own name.

  • public GraphSurfaceNumber[] Numbers

    The graph's float properties.

  • public GraphSurfaceVector[] Vectors

    The graph's float4 properties.

  • public GraphSurfaceMap[] Maps

    The textures it samples, paired with the slots it reads them through.

  • public string ShaderName

    The Raven shader implementing this feature, from Raven/Library/Material.

Methods (2)

  • public static string IndexParameter(string path, string slot)

    What the shader calls a texture's slot, under a composition path.

  • public void Compile(MaterialCompilationContext context)

    Writes this feature's parameters, and fills any slots of its own.

Used by (11)

  • AssetMaterialSourceVixen.Engine.Renderer
  • AssetMaterialSourceTestsVixen.Engine.Renderer.Tests
  • TypeRegistrationVixen.Rendering
  • Vixen_Rendering_Materials_GraphSurfaceFeatureSerializerVixen.Rendering
  • GraphMaterialTestsVixen.Editor.ShaderGraph.Tests
  • MaterialDocumentVixen.Editor.AssetEditors
  • MaterialGraphLinkCommandVixen.Editor.AssetEditors
  • MaterialGraphPropertyTestsVixen.Editor.AssetEditors.Tests
  • MaterialGraphValueCommandVixen.Editor.AssetEditors
  • MaterialViewVixen.Editor.AssetEditors
  • ShaderGraphMaterialVixen.Editor.ShaderGraph