DreamShaderLang

DreamShaderLang

A text-first material language for replacing Unreal Engine material spaghetti graphs.

DreamShaderLang is the source language used by the DreamShader Unreal plugin. It describes Unreal materials, material functions, Material Layers, shared helpers, package dependencies, and graph connections with .dsm, .dsf, and .dsh files. The plugin then generates regular UMaterial, UMaterialFunction, UMaterialFunctionMaterialLayer, and UMaterialFunctionMaterialLayerBlend assets.

This documentation is organized around the language, so DreamShaderLang can be learned, searched, and referenced like a normal programming language.

Tutorial Path

StageReadGoal
StartInstallation, First MaterialSave a .dsm file in an Unreal project and generate a material.
Language basicsFile Model, Top-level Declarations, SectionsUnderstand what belongs in .dsm, .dsf, and .dsh files.
Graphs and helpersGraph Language, Function and Namespace, Layout and RegionWrite node connections, Custom-node helpers, and graph layout as text.
ToolchainPlugin Overview, Editor Support, Asset GenerationUnderstand generation, decompilation, diagnostics, and packages.

Core Model

ConceptRole
.dsmDream Shader Material. Usually generates a material, Material Layer, or project-level asset entry.
.dsfDream Shader Function. Generates reusable ShaderFunction assets and can be imported by .dsm or other .dsf files.
.dshDream Shader Header. Stores shared Function, GraphFunction, Namespace, and import declarations.
ShaderTop-level material declaration that generates an Unreal UMaterial.
ShaderFunctionTop-level material-function declaration that generates an Unreal UMaterialFunction.
ShaderLayerTop-level Material Layer declaration that generates UMaterialFunctionMaterialLayer.
ShaderLayerBlendTop-level Material Layer Blend declaration that generates UMaterialFunctionMaterialLayerBlend.
VirtualFunctionDeclares an existing Unreal material function for Graph calls without generating or overwriting the asset.
GraphGraph DSL that creates Unreal material nodes.
FunctionHLSL-style helper callable from Graph code.
GraphFunctionReusable Custom-node helper that can call UE.* graph nodes inside its body.
LayoutOptional graph metadata. Node(...) pins generated node positions and Comment(...) creates comment boxes.
#RegionNamed group inside Graph, useful for generated layout comments.
NamespaceGroups shared helpers, called as Namespace::Function(...).
PackageDistributable .dsh / .dsf library installed under DShader/Packages.

Public Repositories

Language Layers

DreamShaderLang is not just raw HLSL pasted into a material file. It has three layers:

LayerWritten inBest for
Asset layerShader, ShaderFunction, ShaderLayer, ShaderLayerBlend, VirtualFunctionUnreal asset names, properties, settings, output bindings, and existing function signatures.
Graph layerGraph = { ... }Variables, nodes, expressions, UE.*, material-function calls, helper calls, and simple if / else.
Helper layerFunction, GraphFunction, NamespaceReusable HLSL computation, loops, complex flow, and self-contained Custom-node code.

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;
    }
}

Current Versions

ProjectValue
DreamShader plugin1.4.0
VSCode extension1.5.3
Rider plugintsdaer/dreamshader-language-support
Docs sitelang.64hz.cn
LanguageDreamShaderLang
File extensions.dsm / .dsf / .dsh
AuthorTypeDreamMoon
Main outputsUMaterial / UMaterialFunction / Material Layer function assets

1.4.0 / 1.5.3 Highlights

CapabilityNotes
UE 5.3-5.7 compatibilityDreamShader plugin 1.4.0 is developed against UE 5.7 and verified with single-plugin RunUAT BuildPlugin builds on UE 5.3 through 5.7.
Substrate generationThe plugin supports UE 5.7 Substrate graph values, Base.FrontMaterial output binding, Substrate.* wrappers, and editor-exported Substrate builtin metadata.
Material previewVSCode extension 1.5.3 adds a .dsm material preview panel with local WebSocket streaming and Saved/DreamShader/Bridge/preview.json file-bridge fallback.
Callable hover metadataVSCode extension 1.5.2 shows return and output-pin details for DreamShader callables, UE builtins, and Substrate helpers.
Template / Bridge / Package toolsVSCode extension 1.5.1 adds Template-block language support, bridge commands, status bar integration, diagnostics panel wiring, package tooling, and authoring templates.
.dsf function filesDream Shader Function files generate reusable ShaderFunction assets and support import between .dsm / .dsf files.
Decompile exportExisting Material and Material Function assets can be exported as initial .dsm / .dsf sources.
Layout and RegionLayout = { Node(...); Comment(...); } plus Graph #Region / #EndRegion preserves readable graph structure.
VolumeTexturePlugin and editor extension support VolumeTexture / Texture3D, default textures, completion, and diagnostics.
Function builtinsThe VSCode extension unifies HLSL intrinsics, GLSL aliases, and Unreal sampling helpers for completion, hover, signature help, inlay hints, diagnostics, and semantic highlighting.
Dynamic MaterialExpression metadataThe plugin exports Saved/DreamShader/Bridge/material-expressions.json; VSCode reads reflected UMaterialExpression metadata with a built-in fallback manifest.
Material LayerShaderLayer and ShaderLayerBlend generate native Unreal Material Layer / Layer Blend function assets.
GraphFunctionGraphFunction helpers can use UE.* calls inside Custom-node bodies.
Helper value expressionsSingle-output Function / GraphFunction calls can be used as Graph value expressions.
Material Function stabilityRegeneration preserves input/output IDs for ShaderFunction assets to reduce broken Unreal MaterialFunctionCall links.

On this page