class

MaterialAsset

MaterialAsset wraps a Material with UUID references to texture assets. Load() parses a .mdfmat MDF file. CreateGPU() resolves texture UUIDs via AssetManager.

Module
AssetSystem
Header
#include "AssetSystem/Assets/MaterialAsset.h"
Namespace
Mowo

Type aliases

AliasDescription
using FGraphShaderReadyCallback = void (*)(const Ref<Material>& material)Called when a graph shader finishes compiling during CreateGPU, so the pipeline compile can start before a mesh wearing the material reaches a viewport. The scene renderer installs it: the asset layer sits below the renderer and cannot call it by name.

Constructors

SignatureNameDescription
MaterialAsset()MaterialAsset
~MaterialAsset() override~MaterialAsset

Public functions

ReturnsNameDescription
boolSetScalarParameterR4: runtime material parameters.
boolSetVectorParameter
const std::vector<MaterialGraph::FGraphParam>&GetGraphParameters
uint32_tGetGraphParamLanes
boolHasStaticSwitchOverrideStatic-switch overrides: the permutation this material selects from its root graph.
boolGetStaticSwitchOverride
voidSetStaticSwitchOverride
voidClearStaticSwitchOverride
const MaterialGraph::FStaticSwitchSet&GetStaticSwitchOverrides
boolHasGraphParameterOverride
boolGetGraphParameterOverride
voidSetGraphParameterOverride
voidClearGraphParameterOverride
const std::vector<FGraphParameterOverride>&GetGraphParameterOverrides
boolEffectiveGraphParameterThe value a named graph parameter resolves to for this material: the root graph's default with every override from the root down applied.
const MaterialGraph*CompiledGraphThe graph the compiled shader comes from: this material's own, or the root's for an instance (walked through the asset manager).
MaterialGraph::FStaticSwitchSetEffectiveStaticSwitchesThe switch set this material compiles at: the root graph's defaults with every override from the root down to this material applied in order.
voidSetGraphShaderReadyCallback
FGraphShaderReadyCallbackGetGraphShaderReadyCallback
boolLoadAsset interface
voidUnload
boolCreateGPU
voidDestroyGPU
voidCollectDependencyIDsParent + textures
voidCollectDependencyPathsThe .mphysmat the surface names
Material*GetMaterialThe asset owns the material through a Ref and keeps the SAME object across a reimport (Unload + Load reset it in place), so a raw view taken from here stays valid for as long as the asset lives.
const Ref<Material>&GetMaterialRef
UUIDGetAlbedoTextureIDTexture UUID references (set during Load from .mdfmat)
UUIDGetNormalTextureID
UUIDGetMetallicTextureID
UUIDGetRoughnessTextureID
UUIDGetAOTextureID
UUIDGetEmissiveTextureID
UUIDGetDetailAlbedoTextureID
UUIDGetDetailNormalTextureID
UUIDGetMaskMapTextureID
UUIDGetHeightTextureID
UUIDGetOpacityTextureID
voidSetAlbedoTextureID
voidSetNormalTextureID
voidSetMetallicTextureID
voidSetRoughnessTextureID
voidSetAOTextureID
voidSetEmissiveTextureID
voidSetDetailAlbedoTextureID
voidSetDetailNormalTextureID
voidSetMaskMapTextureID
voidSetHeightTextureID
voidSetOpacityTextureID
UUIDGetParentMaterialIDMaterial instancing
voidSetParentMaterialID
boolIsInstance
boolResolveTexturesTry to resolve texture UUIDs to GPU textures (can be called repeatedly until all resolve) Returns true if all textures are resolved.
boolHasUnresolvedTextures
boolSaveToFileSave material to a .mdfmat MDF file
boolHasGraphNode graph — optional authoring layer.
MaterialGraph&GetGraph
const MaterialGraph&GetGraph
voidSetGraph
voidClearGraph

Function details

MaterialAsset

C++
MaterialAsset()

~MaterialAsset

C++
~MaterialAsset() override

SetScalarParameter

C++
bool SetScalarParameter(const std::string& name, float value)

R4: runtime material parameters. A NAMED Scalar/Vector param node in the graph compiles to a push-constant lane read; these setters write the live value by name (no shader recompile, no pipeline churn). Unknown names return false. Values are per-ASSET (every draw using this material sees the change) and are not serialized — defaults come from the graph on load.

SetVectorParameter

C++
bool SetVectorParameter(const std::string& name, const Vec4& value)

GetGraphParameters

C++
const std::vector<MaterialGraph::FGraphParam>& GetGraphParameters() const

GetGraphParamLanes

C++
uint32_t GetGraphParamLanes() const

HasStaticSwitchOverride

C++
bool HasStaticSwitchOverride(const std::string& name) const

Static-switch overrides: the permutation this material selects from its root graph. A root's switches default from the graph's StaticBool nodes; an instance carries only the names it overrides (absent = inherited), and its compiled shader is the parent graph emitted at the resulting switch set. Serialized as a StaticSwitches section of the .mdfmat.

GetStaticSwitchOverride

C++
bool GetStaticSwitchOverride(const std::string& name, bool& outValue) const

SetStaticSwitchOverride

C++
void SetStaticSwitchOverride(const std::string& name, bool value)

ClearStaticSwitchOverride

C++
void ClearStaticSwitchOverride(const std::string& name)

GetStaticSwitchOverrides

C++
const MaterialGraph::FStaticSwitchSet& GetStaticSwitchOverrides() const

HasGraphParameterOverride

C++
bool HasGraphParameterOverride(const std::string& name) const

GetGraphParameterOverride

C++
bool GetGraphParameterOverride(const std::string& name, Vec4& outValue) const

SetGraphParameterOverride

C++
void SetGraphParameterOverride(const std::string& name, const Vec4& value)

ClearGraphParameterOverride

C++
void ClearGraphParameterOverride(const std::string& name)

GetGraphParameterOverrides

C++
const std::vector<FGraphParameterOverride>& GetGraphParameterOverrides() const

EffectiveGraphParameter

C++
bool EffectiveGraphParameter(const std::string& name, Vec4& outValue) const

The value a named graph parameter resolves to for this material: the root graph's default with every override from the root down applied. False when the root graph declares no parameter of that name.

CompiledGraph

C++
const MaterialGraph* CompiledGraph() const

The graph the compiled shader comes from: this material's own, or the root's for an instance (walked through the asset manager). Null when there is none.

EffectiveStaticSwitches

C++
MaterialGraph::FStaticSwitchSet EffectiveStaticSwitches() const

The switch set this material compiles at: the root graph's defaults with every override from the root down to this material applied in order.

SetGraphShaderReadyCallback

C++
static void SetGraphShaderReadyCallback(FGraphShaderReadyCallback callback)

GetGraphShaderReadyCallback

C++
static FGraphShaderReadyCallback GetGraphShaderReadyCallback()

Load

C++
bool Load(const std::string& path) override

Asset interface

Unload

C++
void Unload() override

CreateGPU

C++
bool CreateGPU(const GPUContext& ctx) override

DestroyGPU

C++
void DestroyGPU() override

CollectDependencyIDs

C++
void CollectDependencyIDs(std::vector<UUID>& out) const override

Parent + textures

CollectDependencyPaths

C++
void CollectDependencyPaths(std::vector<std::string>& out) const override

The .mphysmat the surface names

GetMaterial

C++
Material* GetMaterial() const

The asset owns the material through a Ref and keeps the SAME object across a reimport (Unload + Load reset it in place), so a raw view taken from here stays valid for as long as the asset lives. Hold the Ref instead when the holder may outlive the asset.

GetMaterialRef

C++
const Ref<Material>& GetMaterialRef() const

GetAlbedoTextureID

C++
UUID GetAlbedoTextureID() const

Texture UUID references (set during Load from .mdfmat)

GetNormalTextureID

C++
UUID GetNormalTextureID() const

GetMetallicTextureID

C++
UUID GetMetallicTextureID() const

GetRoughnessTextureID

C++
UUID GetRoughnessTextureID() const

GetAOTextureID

C++
UUID GetAOTextureID() const

GetEmissiveTextureID

C++
UUID GetEmissiveTextureID() const

GetDetailAlbedoTextureID

C++
UUID GetDetailAlbedoTextureID() const

GetDetailNormalTextureID

C++
UUID GetDetailNormalTextureID() const

GetMaskMapTextureID

C++
UUID GetMaskMapTextureID() const

GetHeightTextureID

C++
UUID GetHeightTextureID() const

GetOpacityTextureID

C++
UUID GetOpacityTextureID() const

SetAlbedoTextureID

C++
void SetAlbedoTextureID(UUID id)

SetNormalTextureID

C++
void SetNormalTextureID(UUID id)

SetMetallicTextureID

C++
void SetMetallicTextureID(UUID id)

SetRoughnessTextureID

C++
void SetRoughnessTextureID(UUID id)

SetAOTextureID

C++
void SetAOTextureID(UUID id)

SetEmissiveTextureID

C++
void SetEmissiveTextureID(UUID id)

SetDetailAlbedoTextureID

C++
void SetDetailAlbedoTextureID(UUID id)

SetDetailNormalTextureID

C++
void SetDetailNormalTextureID(UUID id)

SetMaskMapTextureID

C++
void SetMaskMapTextureID(UUID id)

SetHeightTextureID

C++
void SetHeightTextureID(UUID id)

SetOpacityTextureID

C++
void SetOpacityTextureID(UUID id)

GetParentMaterialID

C++
UUID GetParentMaterialID() const

Material instancing

SetParentMaterialID

C++
void SetParentMaterialID(UUID id)

IsInstance

C++
bool IsInstance() const

ResolveTextures

C++
bool ResolveTextures(const GPUContext& ctx, bool blockingImport = true)

Try to resolve texture UUIDs to GPU textures (can be called repeatedly until all resolve) Returns true if all textures are resolved. blockingImport allows pulling a slot's texture in on THIS thread when it is not resident. The editor's async drain passes false: a material with eight 4K slots would otherwise pay eight decodes and eight uploads inside the one frame that receives it, which is the freeze the async importer exists to prevent. Its slots bind on a later pass instead.

HasUnresolvedTextures

C++
bool HasUnresolvedTextures() const

SaveToFile

C++
bool SaveToFile(const std::string& path) const

Save material to a .mdfmat MDF file

HasGraph

C++
bool HasGraph() const

Node graph — optional authoring layer. When present it is the authority: compiling it produces the flat PBR fields + texture UUIDs above (the runtime never sees the graph). Absent → the flat fields are used directly, which is what keeps older graph-less materials working.

GetGraph

C++
MaterialGraph& GetGraph()

GetGraph

C++
const MaterialGraph& GetGraph() const

SetGraph

C++
void SetGraph(const MaterialGraph& graph)

ClearGraph

C++
void ClearGraph()
Generated from AssetSystem/Assets/MaterialAsset.h via assetsystem.json · Nov 4, 2026Version 1.0.0