DreamShaderLang
Language Core

File Model

Basic rules for .dsm, .dsf, .dsh, top-level blocks, and imports.

DreamShaderLang uses three source file types. They share the same parser, but each file type has a different intended role.

.dsm

.dsm is the material source file. It usually contains:

BlockRole
ShaderGenerate a UMaterial.
ShaderLayerGenerate a Material Layer function asset.
ShaderLayerBlendGenerate a Material Layer Blend function asset.
importBring in shared helpers or package files.

Example:

import "Shared/Common.dsh";

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

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

    Graph = {
        Color = Tint;
    }
}

.dsf

.dsf is the Dream Shader Function file. It usually contains ShaderFunction and can also import shared helpers.

ShaderFunction(Name="DreamFunctions/F_Tint")
{
    Inputs = {
        vec3 Color;
        float Strength = 1.0;
    }

    Outputs = {
        vec3 Result;
    }

    Graph = {
        Result = Color * Strength;
    }
}

.dsh

.dsh is the shared header file. It does not directly generate an Unreal asset. Use it for imports, Function, GraphFunction, and Namespace.

Namespace ColorTools
{
    Function float Luma(vec3 color)
    {
        return dot(color, vec3(0.2126, 0.7152, 0.0722));
    }
}

Top-level Blocks

BlockAllowed role
ShaderMaterial asset.
ShaderFunctionMaterial Function asset.
ShaderLayerMaterial Layer function asset.
ShaderLayerBlendMaterial Layer Blend function asset.
VirtualFunctionSignature for an existing Unreal Material Function.
FunctionHLSL-style helper.
GraphFunctionHelper that can contain UE.* graph calls.
NamespaceGroups shared helpers.

Comments

DreamShaderLang supports C-style comments:

// Line comment

/*
   Block comment
*/

Case Sensitivity

Keywords and identifiers are case-sensitive. Keep Unreal-facing names stable because they map to generated asset paths, parameters, and output bindings.

On this page