DreamShaderLang
DreamShader Plugin

Plugin Workflow

Daily workflow from editing DreamShaderLang to generating Unreal material assets.

The normal workflow is edit source, save, let the plugin compile, and inspect the generated asset in Unreal. The VSCode and Rider language plugins improve the editing side, while the Unreal plugin owns generation.

Daily Flow

  1. Edit .dsm, .dsf, or .dsh under DShader.
  2. Use editor diagnostics to catch syntax and semantic issues.
  3. Save the source file.
  4. DreamShader resolves imports and recompiles affected assets.
  5. Inspect the generated Unreal asset and material compilation output.
  6. For .dsm materials, use DreamShaderLang: Show Material Preview in VSCode to inspect the current generated material.

.dsm Workflow

.dsm files usually contain Shader, ShaderLayer, or ShaderLayerBlend declarations.

SectionTypical role
PropertiesMaterial parameters and input nodes.
SettingsMaterial domain, blend mode, shading model, and Unreal properties.
OutputsOutput variables and bindings to Base.*.
GraphNode graph expressed as statements.
LayoutOptional node positions and comment boxes.

.dsh Workflow

.dsh files do not generate assets directly. They are shared headers for imports, namespaces, Function, and GraphFunction helpers.

When a .dsh changes, DreamShader recompiles the dependent .dsm / .dsf files instead of trying to compile the header itself.

.dsf Workflow

.dsf files are for reusable material-function assets:

UseNotes
ShaderFunctionGenerates a UMaterialFunction.
Import targetCan be imported by .dsm or other .dsf files.
Stable regenerationInput/output IDs are preserved to reduce broken Unreal MaterialFunctionCall links.

Material Layer Workflow

Use:

DeclarationAsset
ShaderLayerUMaterialFunctionMaterialLayer
ShaderLayerBlendUMaterialFunctionMaterialLayerBlend

These are the recommended top-level blocks for native Unreal Material Layer assets.

Generation and Cache

DreamShader tracks source hashes and dependency relationships. If source content and relevant imported files have not changed, regeneration can be skipped or limited to affected assets.

Material Preview

The VSCode Show Material Preview command requests a preview for the active .dsm material through the Unreal bridge. Unreal resolves the source, generates the material if needed, and writes preview output under:

Saved/DreamShader/Bridge/preview.json
Saved/DreamShader/Bridge/Preview/*.png

When the local preview WebSocket is available, the extension connects to 127.0.0.1:17864 and receives preview results plus live frames. If WebSocket is unavailable, or dreamshader.previewTransport is set to file, it falls back to request files and the preview manifest. Preview is for .dsm material sources, not .dsf or .dsh files.

Decompile Migration

Existing Unreal Material and Material Function assets can be exported to initial .dsm / .dsf files. Common nodes become Graph syntax; less common nodes fall back to generic UE.Expression(...) calls.

Treat exported files as a starting point. Review names, layout, helper extraction, and imports before making them the canonical source.

Team Collaboration

PracticeReason
Keep source files small and named by asset purposeEasier reviews and import tracking.
Put shared helpers in .dsh or packagesAvoid repeated graph logic.
Commit package manifestsRebuilds are reproducible.
Keep generated asset policy explicitTeams differ on whether generated .uasset files are committed.

On this page