DreamShaderLang

Overview

DreamShaderLang is a text language for Unreal Engine materials, compiled by the DreamShader plugin into ordinary material assets.

DreamShaderLang is a text language for Unreal Engine materials. You write .dsm, .dsf and .dsh files; the DreamShader plugin parses them inside the editor and builds standard Unreal assets — UMaterial, UMaterialFunction, UMaterialFunctionMaterialLayer and UMaterialFunctionMaterialLayerBlend.

The source file is the authoring surface. The asset is build output, and can always be thrown away and regenerated.

Plugin version1.5.0
EnginesUnreal Engine 5.35.8, Win64 verified
ModulesDreamShader (Runtime), DreamShaderCompiler (Runtime), DreamShaderEditor (Editor)
Source extensions.dsm · .dsf · .dsh
Project settingsProject Settings ▸ DreamPlugin ▸ Dream Shader
LicenseMIT

Three kinds of source file

ExtensionNameHoldsGenerates
.dsmDream Shader Materialat most one Shader, plus any function, layer, namespace or virtual-function blockthe material, and every function asset declared beside it
.dsfDream Shader FunctionShaderFunction, ShaderLayer, ShaderLayerBlend and helper blocks — no Shaderthe function assets it declares
.dshDream Shader HeaderFunction, GraphFunction, Namespace, VirtualFunction, importsnothing directly; it is consumed through import

import directives are inlined into one text before parsing, so a translation unit is the whole import closure, not the single file. That is why "one Shader per file" really means one Shader per closure. See Source Files.

What a block generates

BlockUnreal asset
ShaderUDreamShaderMaterialInstance over a hidden UMaterial base (ThinCustom, the default), or a plain UMaterial (Graph backend)
ShaderFunctionUMaterialFunction
ShaderLayerUMaterialFunctionMaterialLayer
ShaderLayerBlendUMaterialFunctionMaterialLayerBlend
VirtualFunctionnothing — it declares an existing UMaterialFunction so Graph can call it
Function / GraphFunctionCustom node code, plus one generated .ush helper include

A minimal material

Shader(Name="DreamMaterials/M_Minimal")
{
    Properties = {
        vec3 Tint = vec3(1.0, 0.2, 0.2);
    }

    Settings = {
        Domain = "UI";
        ShadingModel = "Unlit";
    }

    Outputs = {
        vec3 Color;
        Base.EmissiveColor = Color;
    }

    Graph = {
        Color = Tint;
    }
}

Saving that file under DShader/ builds /Game/DreamMaterials/M_Minimal.

With the default ThinCustom backend the generated material lives in memory only and does not appear in the Content Browser. That is deliberate, and there are three ways to reach it — see Your First Material.

What DreamShader does, and what it does not

It generates material assets in the Unreal editor. That is the whole scope. Specifically:

  • Graph is a node-graph builder, not a shader compiler. It has four arithmetic operators, if / else, and nothing else. No loops, no ternary, no %, no bitwise or comparison operators outside an if condition, no matrices, no arrays or indexing, no compound assignment. Several of those truncate silently rather than erroring — read What Graph Is Not before you write your first non-trivial graph. Genuinely imperative code belongs in a Function, whose body is real HLSL.
  • Generation is editor-only. There is no runtime path that builds a material from DreamShaderLang, and none of the tooling exists in a packaged game.
  • A generated asset is output, not a document. Regeneration tears the graph down and rebuilds it, destroying hand edits; parameter overrides set directly on a generated instance are cleared on every rebuild. See Regeneration.
  • Substrate.* requires since UE 5.4 and a plugin binary built against 5.4 or newer — the gate is compile-time.
  • Some spellings are already deprecated. These are the Instance backend value and the MaterialLayer / MaterialLayerBlend block spellings.

Where to go next

On this page