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:
| Block | Role |
|---|---|
Shader | Generate a UMaterial. |
ShaderLayer | Generate a Material Layer function asset. |
ShaderLayerBlend | Generate a Material Layer Blend function asset. |
import | Bring 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
| Block | Allowed role |
|---|---|
Shader | Material asset. |
ShaderFunction | Material Function asset. |
ShaderLayer | Material Layer function asset. |
ShaderLayerBlend | Material Layer Blend function asset. |
VirtualFunction | Signature for an existing Unreal Material Function. |
Function | HLSL-style helper. |
GraphFunction | Helper that can contain UE.* graph calls. |
Namespace | Groups 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.