DreamShaderLang

Overview

DreamShaderLang is a text language for Unreal Engine materials, compiled by the DreamShader plugin into ordinary material assets; on UE 5.8, .dsp sources add render passes of your own.

DreamShader reference

For tutorials and task-oriented reading, start at the documentation overview.

DreamShader compiles DreamShaderLang source files — .dsm, .dsf, .dsh and, on the 2.0 line, .dss — into standard Unreal Engine material assets: UMaterial, UMaterialFunction, UMaterialFunctionMaterialLayer, and UMaterialFunctionMaterialLayerBlend — and, on Unreal Engine 5.8, .dsp Custom Pass pipelines into UDreamPassPipeline assets that add render passes of your own. Source files are the authoring surface; the assets are build output and can always be regenerated.

Version2.2.0
EnginesUnreal Engine 5.3 – 5.8 (Win64 verified); Custom Pass needs 5.8
ModulesDreamShaderLang (Runtime), DreamShader (Runtime), DreamShaderPass (Runtime), DreamShaderCompiler (Editor), DreamShaderEditor (Editor)
Source extensions.dsm material · .dsf function · .dsh header · .dss 2.0 compilation unit · .dsi material instance · .dsp Custom Pass pipeline
Project settingsProject Settings ▸ DreamPlugin ▸ Dream Shader
LicenseMIT

New here? Start with Getting started, then Examples.


DreamShaderLang

[!NOTE] Two syntaxes, one compiler. The 1.x syntax documented below (.dsm / .dsf / .dsh) is the one that ships. The 2.0 syntax — .dss, HLSL with declarations instead of section blocks — compiles through the new binder/IR/emitter pipeline on the 2.0 line and has its own page: DreamShaderLang 2.0.

Language reference

The declaration grammar: source files, blocks, and sections.

Source files.dsm / .dsf / .dsh and what each may contain
Lexical elementsComments, identifiers, case sensitivity, literals, suffixes
Keyword indexEvery reserved word and alias, with links
importIncluding headers, functions, and packages
Preprocessor#if and the define table — conditional compilation
TypesType tokens, GLSL aliases, per-context validity

Top-level blocks

ShaderGenerates a UMaterial
ShaderFunctionGenerates a UMaterialFunction
ShaderLayer / ShaderLayerBlendGenerates native material layer functions
VirtualFunctionDeclares an existing UMaterialFunction
FunctionReusable HLSL helper
GraphFunctionHLSL helper that may pull UE.* nodes into its inputs
NamespaceGroups helpers under Ns::Name

Sections

PropertiesParameter declarations and group scopes
Inputs / OutputsFunction signatures and material outputs
Output bindingsBase.<Target> = <value>;
SettingsMaterial and function settings
OptionsVirtualFunction asset binding
LayoutNode placement, comment boxes, #Region

Graph language

The statement and expression language inside Graph = { ... }, which materialises material nodes.

StatementsEvery statement form
DeclarationsVariables, initialisers, scope
Expressions and operatorsPrecedence, operand rules, integer division
LiteralsNumeric, boolean, suffixes
Constructorsfloat3(...), vec4(...), integer constructors
SwizzlesChannel masks, reorder, repeat
ConversionsWidening, narrowing, component-count rules
if / elseConditions, truthiness, branch selection
MaterialAttributesStruct-like member writes
CallsCalling functions and parameter pins
Name resolutionLookup order and shadowing
Node reuseCommon-subexpression deduplication
Unsupported constructsLoops, return, %, indexing — and what happens instead

Node library

Builtins

UE.* catalogueEvery named material-node builtin
UE.ExpressionThe generic reflected-node escape hatch
OutputType valuesEvery accepted output-type token
Math builtinslerp, saturate, frac, …
Transform builtinsUE.TransformVector / UE.TransformPosition bases
Substrate.*Substrate nodes (UE 5.4+)
Custom Pass nodesUE.DreamPassOutput, UE.DreamPassBuffer (UE 5.8)
DreamShaderBuiltins.ushShipped HLSL helper header

Parameters

Compact typesfloat, float3, Texture2D, …
Parameter nodesScalarParameter, StaticSwitchParameter, …
Metadata blockGroup, SortPriority, Slider, reflected properties
SamplerTypeTexture sampler configuration
Using parameters in GraphValue reads and pin call forms
Path(...)Asset references

Custom Pass

Render passes of your own on Unreal Engine 5.8, without changing the engine: masks and custom buffers, screen-space effects, compute shaders writing data textures.

Pipelines — .dspBuffers, passes, injection points, bindings, mesh selection, what the compiler checks
RuntimeWhat makes a pipeline apply, when passes run, built-in and exported buffers, views, debugging, limits
HLSL passesThe fixed parameters, slots, snapshots and the pre-check
Material nodesUE.DreamPassOutput for mesh passes, UE.DreamPassBuffer to read an exported buffer
ExamplesHighlight outline, UI frosted glass, X-ray, wind field
DreamShaderPassThe module's C++ and Blueprint API

Build and output

Settings

Material settingsSpecial keys plus reflected UMaterial properties
Enum valuesEvery ShadingModel, BlendMode, Domain
BackendThinCustom vs Graph
Function settingsKeys honoured by material functions
Project settingsDreamPlugin ▸ Dream Shader

Generation

Asset pathsName= and Root= to package and disk paths
Ephemeral materialsThe thin instance, hidden base, cook behaviour
CachingSource hashing and skipped rebuilds
Graph layoutAutomatic placement and its limits
RegenerationWhat survives a rebuild and what does not
DivergenceHand-edited assets: detection, and the three ways out
NoGenerationSources only a compile that names them builds
Generated HLSLThe emitted .ush include

Tooling

Editor tools

Editor integrationMenus, toolbar, context menus
Material Content BrowserBrowse, filter, instance, materialize
PreviewThumbnail and streaming preview
DecompilerExport existing materials, instances and Custom Pass pipelines to source
VirtualFunction toolsDeclare and sync existing functions
Workspace and editor extensionsVSCode workspace, VSCode and Rider plugins
PackagesDShader/Packages shared libraries
CommandletHeadless compile and decompile
Editor bridgeRequest files, WebSocket protocol, artifacts

C++ API

DreamShaderModule.hModule, log category, exported functions
DreamShaderTypes.hThe parsed-source data model
DreamShaderParser.hRetired in 2.0 — what replaced the 1.x parser entry point
DreamShaderSettings.hUDreamShaderSettings
DreamShaderMaterialInstance.hThe generated instance class
DreamShaderVersionCompat.hEngine-version macros
DreamShaderCompilerCompiler interfaces and service
DreamShaderPassCustom Pass: the pipeline asset, settings, subsystem, volume and components

Reference

Diagnostics indexEvery error and warning, with cause and fix
Disabling diagnosticsdisable_warning / disable_error, for a file or a line
ExamplesComplete, copy-pasteable sources
ContributingBuilding the plugin
TestingAutomation suite and the fixture corpus
ReleaseTagging and packaging

On this page