DreamShaderLang
Compiler Behavior

Asset Generation

Generation flow from .dsm / .dsf / .dsh to UMaterial / UMaterialFunction assets.

DreamShader turns source files into Unreal assets through parsing, import resolution, semantic analysis, graph generation, and asset saving.

Generation Flow

  1. Scan source files under SourceDirectory.
  2. Parse .dsm, .dsf, and .dsh.
  3. Resolve imports and packages.
  4. Build declarations and helper symbols.
  5. Generate Unreal material nodes from Graph.
  6. Apply settings, outputs, layout, and metadata.
  7. Save or refresh generated assets.
  8. Report diagnostics back to the editor bridge.

.dsm and .dsh

.dsm usually generates material assets. .dsh does not generate an asset directly; it provides shared imports and helpers. When .dsh changes, dependent .dsm / .dsf files are recompiled.

Asset Paths

Shader(Name="DreamMaterials/M_Minimal")

Generates:

/Game/DreamMaterials/M_Minimal.M_Minimal

Use Root="Plugin.MyPlugin" to generate under a content plugin root.

Node Generation

Graph statements become Unreal material expression nodes:

Graph codeGenerated concept
float t = UE.Time();Time node.
Color = Tint * Strength;Multiply and output wiring.
UE.Expression(...)Generic reflected MaterialExpression.
Function callCustom-node helper or generated HLSL call.
ShaderFunction / VirtualFunction callMaterial Function Call node.

VirtualFunction References

VirtualFunction declarations reference existing Unreal material functions. The generator creates calls to those functions but does not create or overwrite the assets.

Function Generation

Normal Function helpers may generate helper include code or Custom-node snippets, depending on helper type and generator behavior. GraphFunction can create auxiliary graph nodes for UE.* calls used inside the helper body.

Source Hash Cache

The plugin tracks source hashes and dependency relationships. If relevant source content has not changed, regeneration can be reduced or skipped.

Material Reset

Generated assets are regenerated from source-defined values. Put settings, parameters, outputs, and layout that must survive regeneration into the source files.

Decompile Export

The plugin can export existing Material and Material Function assets as initial .dsm / .dsf sources. Common nodes are converted to Graph syntax; unsupported nodes fall back to generic UE.Expression(...) entries.

On this page