|
Text-first Unreal Engine material authoring with DreamShaderLang.
DreamShader compiles 中文文档 · Documentation · Getting started · Language reference · Examples · AI skills · Changelog QQ group: 466585194 |
|
Tip
Keep every .dsm, .dsf and .dsh file in version control. The generated Unreal assets can
always be rebuilt from source, so they do not need to be.
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;
}
}Save the file and DreamShader builds /Game/DreamMaterials/M_Minimal. Name is the asset path
relative to Root, which defaults to Game; Root="Plugin.MyPlugin" generates into a content
plugin instead.
By default materials are generated in memory — no .uasset is written and nothing appears in
the Content Browser, because the source file is what you edit. Cooking materialises them
automatically, and you can materialise one by hand from the Material Content Browser.
-
Copy the plugin into your project, enable DreamShader in Edit ▸ Plugins, and restart the editor. The engine plugins
WebSocketNetworkingandSQLiteCoreare enabled automatically. -
Create the source directory in the project root and add a
.dsmfile:MyProject/ ├─ DShader/ │ ├─ Materials/ *.dsm material implementations │ ├─ Functions/ *.dsf reusable material function assets │ ├─ Shared/ *.dsh headers: Function, GraphFunction, Namespace, VirtualFunction │ └─ Packages/ installed shared libraries └─ Plugins/ └─ DreamShader/ -
Save it. With Auto Compile On Save on — the default — the source is parsed after a short debounce and the asset is built.
Settings live under Project Settings ▸ DreamPlugin ▸ Dream Shader; every key and its default is on Project settings. The full walkthrough is Getting started.
| Block | Produces | Reference |
|---|---|---|
Shader |
a UMaterial |
Shader |
ShaderFunction |
a UMaterialFunction |
ShaderFunction |
ShaderLayer |
a native UMaterialFunctionMaterialLayer |
ShaderLayer |
ShaderLayerBlend |
a native UMaterialFunctionMaterialLayerBlend |
ShaderLayer |
VirtualFunction |
nothing — declares an existing asset so Graph can call it |
VirtualFunction |
Function |
one HLSL Custom node, via a generated .ush helper |
Function |
GraphFunction |
a Custom node that may pull UE.* nodes into its inputs |
GraphFunction |
Namespace |
nothing — groups helpers as Ns::Name |
Namespace |
The three source kinds are not interchangeable: .dsm holds at most one Shader, .dsf holds
function assets and may not declare a Shader, and .dsh is a header consumed through import.
See Source files.
Graph = { … } is where the node graph is written — declarations, arithmetic, swizzles, UE.*
material nodes, math builtins, function calls and if / else. Typed Properties cover scalars,
vectors, textures, switches, MPC values and reflected node settings. MaterialAttributes and
Substrate (UE 5.4+) are first-class values that can be passed through graph code, function
signatures and output bindings.
The full reference lives in Docs/, and is published at
https://lang.64hz.cn/docs in Chinese and English.
| Language reference | source files, lexical rules, top-level blocks, sections, types, import |
| Graph language | statements, expressions, conversions, swizzles, if / else, calls — and what Graph is not |
| Builtins | the UE.* catalogue, math builtins, Substrate.*, the UE.Expression escape hatch |
| Parameters | the 21 parameter-node tokens, compact types, metadata keys, SamplerType |
| Settings | material settings and their enum values, function settings, project settings |
| Generation | asset paths, in-memory materials, caching, graph layout |
| Editor tools | browser, preview, decompiler, workspace, packages, bridge, commandlet |
| Diagnostics | every message the compiler can emit, by pipeline stage |
| Examples | complete sources you can copy as they are |
| C++ API | the public headers, for extending the plugin |
| Material Content Browser | Tools ▸ DreamShader. The Project page browses every material under /Game with its full inheritance chain and one-click instance creation; the Dream Shader Gen page lists your sources with a live preview, compile-all and error surfacing |
| Decompiler | right-click a Material or Material Function ▸ DreamShader ▸ Export DSM/DSF. A migration starting point — common nodes become graph text, the rest falls back to UE.Expression(…) so the structure stays regeneratable |
| Packages | reusable .dsh libraries under DShader/Packages/@scope/name/, imported as import "@typedreammoon/dream-noise/Library/Noise.dsh"; |
| Workspace | the generated DShader/DreamShader.code-workspace, opened in VSCode from the editor toolbar |
| Commandlet | -run=DreamShader compile | decompile — headless generation for CI |
| Editor | Repository | Features |
|---|---|---|
| VSCode | TypeDreamMoon/dreamshader-language-support | highlighting, snippets, completion, go to definition, find references, hover, signature help, local and bridge diagnostics, material preview, package commands, templates |
| Rider | tsdaer/dreamshader-language-support | .dsm / .dsf / .dsh file types, grammar and PSI parsing, highlighting, completion, navigation, diagnostics, bridge integration, semantic tokens, inlay hints, package tools |
DreamShaderLang is a text format, so a coding agent can author it — but only if it can check its
own work. .skill/ ships the harness that closes that loop: a headless driver
plus five skills, in the Claude Code skill format.
| Skill | Argument | Does |
|---|---|---|
dream-shader-create |
<description> |
writes a new material or function from plain language, then compiles it to prove it builds |
dream-shader-optimize |
<file> |
dedupes, renames, retargets and restores lost state in a decompiled source |
dream-shader-decompile |
<asset> |
exports an existing UMaterial / UMaterialFunction back to source |
dream-shader-verify |
<file> | -All |
compiles headlessly; exit 0 / 1 |
dream-shader-diagnose |
<message> |
routes a diagnostic to its pipeline stage, explains it, fixes it |
dsc.ps1 wraps the commandlet: it resolves the engine from the
.uproject's EngineAssociation, finds the project by walking up, prints only the LogDreamShader
lines, and — because a headless compile writes real .uasset files where the editor generates in
memory — classifies everything the run wrote against git so a probe asset never survives as
untracked clutter.
pwsh -File Plugins/DreamShader/.skill/dsc.ps1 compile DShader/Materials/M_Panel.dsm -Force -CleanNewPublish the skills into .claude/skills/ once, and an agent working anywhere in the project loads
them by name:
pwsh -File Plugins/DreamShader/.skill/sync-skills.ps1Note
Only the auto-loading is Claude Code specific. The driver is a plain PowerShell script and each
SKILL.md is plain Markdown, so any agent — or any human — can read the instructions and run the
same commands. .skill/reference/dreamshaderlang.md
condenses the grammar an author actually needs, including the traps that only surface at compile
time: the 19 reserved math builtins that shadow user code silently, the whole-identifier GLSL
rewrite inside Function bodies, and the absent matrix types.
Unreal Engine 5.3 – 5.8 on Win64, each verified with a single-plugin RunUAT BuildPlugin build.
Active development targets 5.8.
Validating the plugin without building a project target
& "<EngineDir>\Engine\Build\BatchFiles\RunUAT.bat" BuildPlugin `
-Plugin="<ProjectDir>\Plugins\DreamShader\DreamShader.uplugin" `
-Package="<OutputDir>\DreamShader" `
-TargetPlatforms=Win64 `
-RocketOn Windows, UE 5.3 and 5.4 may require the MSVC 14.38 toolchain — newer compilers can fail
while compiling older engine headers, before plugin code is reached.
Note
The decompiler is a migration helper, not a round-trip guarantee. It handles many common materials
and some large Lyra cases, and leaves a // Warning: comment for everything it could not
reproduce. The known round-trip gaps are worth
reading before deleting an original asset.
| Version | 1.5.1 |
| Language | DreamShaderLang |
| Unreal Engine | 5.3 – 5.8 |
| Modules | DreamShader, DreamShaderCompiler (Runtime), DreamShaderEditor (Editor) |
| Author | TypeDreamMoon |
| GitHub | https://github.com/TypeDreamMoon |
| Docs | https://lang.64hz.cn/ |
| Web | https://dev.64hz.cn |
| License | MIT |
| Copyright | Copyright (c) 2026 TypeDreamMoon. All rights reserved. |
Releasing is documented on Release; building the plugin from source on Contributing.
- Custom full-screen render pass support.
- More complete VSCode semantic diagnostics.
- Deeper Material Layer Stack and Layer Instance workflow support.
- Deeper Moon Engine integration — reference: https://zhuanlan.zhihu.com/p/21979494450
DreamShader is released under the MIT license. For bug reports and feature requests, open an issue.




