Layout and Region
Use the Layout section and Graph
Layout is optional metadata for generated graph readability. It does not change shader
math. Use it to pin important nodes, create comment boxes, and preserve decompiled layout
hints.
Graph Region
Regions live inside Graph:
Graph = {
#Region "Pulse"
float t = UE.Time();
float pulse = sin(t) * 0.5 + 0.5;
#EndRegion
Color = Tint * pulse;
}Regions are useful for grouping generated nodes and producing comment boxes.
Layout Section
Add a Layout section next to Graph:
Layout = {
Node("Tint", X=0, Y=0);
Comment("Pulse", X=-160, Y=-120, W=520, H=260);
}The compiler treats layout as metadata. Invalid layout entries should not be used to hide real graph issues.
Node(...)
Node(...) pins a generated node by logical name:
Node("Tint", X=0, Y=0);
Node("Color", X=420, Y=0);| Field | Meaning |
|---|---|
| first argument | Node or generated variable name. |
X | Horizontal position. |
Y | Vertical position. |
Comment(...)
Comment(...) creates a graph comment:
Comment("Pulse", X=-160, Y=-120, W=520, H=260);| Field | Meaning |
|---|---|
| first argument | Comment title. |
X, Y | Top-left position. |
W, H | Size. |
Full Example
Shader(Name="DreamMaterials/M_Layout")
{
Properties = {
vec3 Tint = vec3(0.2, 0.6, 1.0);
}
Outputs = {
vec3 Color;
Base.EmissiveColor = Color;
}
Graph = {
#Region "Pulse"
float t = UE.Time();
float pulse = sin(t) * 0.5 + 0.5;
#EndRegion
Color = Tint * pulse;
}
Layout = {
Node("Tint", X=0, Y=0);
Node("Color", X=520, Y=0);
Comment("Pulse", X=160, Y=-140, W=320, H=260);
}
}Decompiled Layout
When a material or material function is exported to .dsm / .dsf, the exporter may emit
Layout entries and regions so the text source preserves useful graph structure. Review
these entries after export; generated names may need cleanup.
Diagnostics
| Problem | Fix |
|---|---|
| Layout references an unknown node | Check the variable or node name used in Node(...). |
| Comment has invalid size | Provide positive W and H. |
| Region is not closed | Add matching #EndRegion. |
| Layout does not affect shader output | This is expected; layout is metadata only. |