Visual Shaders
A material whose Shader Mode is Visual Shader gets its shader from a node graph instead of a shader file. The graph is edited in the Visual Shader panel, below the material's 3D preview. The preview follows the graph while you edit it, so you see the result without transforming the material. Transform writes the shader that the game uses.
To mix several surfaces, such as mud, puddles and snow, you usually do not need to build a graph by hand: a layered material builds one for you from a stack of layers. Graph authors can use the same material layer nodes directly.
An alternative to visual shaders is to write a custom shader based on a shader template.

Creating a visual shader
- Create a material asset, or open an existing one.
- In the material's properties, set Shader Mode to Visual Shader. The Visual Shader panel appears below the preview.
- Add nodes with Space over the canvas, a right-click on the background, or by dragging a wire from a pin into empty space. Nodes come in categories such as Input, Constants, Parameters, Texturing, Math, UV, Color, Logic, Procedural, Utils and Output.
- A graph has exactly one output node from the Output category (MaterialOutput for regular materials, see Output nodes for the others). Connect node outputs to its inputs (base color, normal, roughness, and so on).
- Save, and transform the material when you want the game to use it.
Clean Visual Shader Graph removes every node that does not lead to the output node.
Parameter nodes and Texture nodes become properties of the material, so materials that use this one as a base material can set them differently. Use a parameter for a value another material should change, and a Constants node or a typed-in input value for everything else.
Texture Cube samples a cube map, and texture nodes use mip mapping. Custom Function (category Utils) calls a function from a shader header of the project, so several materials can share code written once: set Include to the header's path below a data directory (as in an #include) and Function to its name. The function takes four float4 (the inputs a to d) and returns a float, float2, float3 or float4, for example float3 MyTint(float4 a, float4 b, float4 c, float4 d) { return a.rgb * b.x; }. A function that reads textures or uses ddx/ddy cannot feed a position offset.
The node graph editor shares its controls with the other graph editors: drag a marquee on the background to select several nodes, and press C to put a comment box around the selected nodes.
Output nodes
The output node decides what the material is for. Pick it from the Output category; a node that the chosen output cannot use (for example one that reads the scene colour in a decal) is marked on the node with what it needs.
| Output node | Use it for | Where the material goes |
|---|---|---|
| MaterialOutput | Standard lit PBR surfaces. Has the blend mode, shading mode, two-sided, weather and subsurface profile options. | Mesh components. |
| OpenPBROutput | OpenPBR Surface materials: a base with a metal and a dielectric part, and the layers coat, fuzz, subsurface, transmission and thin film. A layer is only compiled in when its weight is connected or above 0. Transmission draws the material with the transparent objects. | Mesh components. |
| UnlitOutput | Surfaces that no light affects: holograms, UI in the world, force fields, stylised looks. Cheaper than the standard output. Pins: Color, Opacity, Emissive, Emissive Intensity and position offsets. | Mesh components. |
| DecalOutput | Projected PBR decals and light cookies. | A decal component's Material, see Decal Materials; spot and rect light cookies use its Base Color and Opacity. |
| QuadParticleOutput, TrailParticleOutput, RibbonParticleOutput | Billboard and sprite particles, trails and ribbons. On trails and ribbons the U coordinate runs along the strip. | The Custom Material of a Quad, Trail or Ribbon particle type. |
| PostEffectOutput | Materials that change the whole image. | A Post Effect component, see Post effects. |
| SkyOutput | The colour of the sky in every direction. | A Sky Box component's Sky Material, see Sky materials. |
Graph materials take part in order-independent transparency and write motion vectors like the built-in materials. The background compile check after a Transform compiles the configuration the material is set to (its blend mode, shading mode and so on).
Node thumbnails are only drawn for surface outputs; decal, particle, post effect and sky outputs cannot draw a mesh.
Post effects
A post effect is a material that changes the rendered image: a vignette, a colour tint, a heat-haze distortion, scan lines, an outline from the depth buffer. You build it as a graph and put it into the scene with a Post Effect component.
- Create a material, set Shader Mode to Visual Shader and use a PostEffectOutput node as the output.
- Build the new colour of each pixel. The nodes of the Post Effect category read the scene behind each pixel:
| Node | Outputs |
|---|---|
| SourceColor | The image so far at a position on the screen (RGB and its channels). Offset the UV input to distort the image; sample several times to blur it. |
| SceneAlbedo | Albedo and metalness of the opaque surface behind the position, from the G-buffer. White and not metallic in pipelines without a G-buffer at that point. |
| SceneNormal | World-space normal and roughness of the opaque surface behind the position. A normal facing the camera and roughness 1 without a G-buffer. |
| SceneVelocity | How far the scene behind the position moved since the last frame, in screen UV units. Zero without velocity. |
The UV node gives the position on the screen (0,0 top left, 1,1 bottom right), and the world position and depth nodes describe the scene behind each pixel.
- Connect Color (default: the image as it is) and Opacity (0 to 1, how much of the new colour is used) of the output node.
- Transform the material, add a Post Effect component (category Effects) to an object in the scene, and set its Material.
The material editor shows a post effect over the whole preview, on top of the preview model.
Post Effect component:
| Property | Default | Description |
|---|---|---|
Material | none | The post effect material. |
Stage | Scene | Scene: on the lit HDR image, in front of anti-aliasing, depth of field, bloom and tonemapping, so the effect is anti-aliased and blooms like the scene. Display: on the tonemapped image (colours 0 to 1), for vignettes, scan lines, pixelation and everything that should stay sharp. |
Weight | 1 | How much of the effect is blended over the image, 0 to 1. Animate it to fade the effect in and out. It multiplies the material's Opacity. |
Order | 0 | Effects with a lower order are applied first. |
Global | On | The effect applies to every camera. Off limits it to the box set by Extents. |
Extents | 10, 10, 10 | Size of the box of a local effect. The effect has its full weight while the camera is inside it. |
FadeDistance | 2 | Distance outside the box over which a local effect fades out. |
Several components stack. The effect is drawn in the main view, editor views, thumbnails and cameras that render to a texture; shadow and reflection views do not get it. The engine adds the passes that draw post effects to every render pipeline by itself through render pipeline injection, so no pipeline asset has to be edited. In a pipeline without a tonemapper, Display effects are drawn with the Scene effects.
Sky materials
A sky material computes the colour of the sky per direction, so you can build procedural skies, stylised gradients or animated space backgrounds instead of using a cube map.
- Create a material, set Shader Mode to Visual Shader and use a SkyOutput node as the output.
- Use the Sky Direction node (category Input) for the direction a pixel looks in. It is normalized and Z is up; the Sky Box component's rotation turns it.
- Connect Color: the colour of the sky in that direction as a luminance in nits (a clear day sky is a few thousand nits). With the node's Apply Fog on (the default), fog is applied as if the sky were Fog Distance away (default 1000).
- Transform the material, and set it as the Sky Material of a Sky Box component.
While a sky material is set, it takes the place of the cube map: the cube map and the properties that scale it (exposure, calibration, sun clamp, inverse tonemap, fog) have no effect. The sky lights the scene through the sky light the same way a cube map does. The material editor shows a sky material as the preview's sky.
Live preview
With Live Preview on (the default), every edit of the graph reaches the preview by itself:
- Changing a value (a constant, a colour, an input value typed into a node) updates the preview straight away. The preview reads these values from the material's constants, so nothing compiles.
- Changing the graph (adding, removing or connecting nodes, or a setting that changes the generated code) compiles a new preview shader in the background shortly after the last edit, only for what the preview draws. Until it is ready, the preview keeps the last shader that compiled, so it never turns black or disappears.
- New Parameter and Texture nodes show up in the material's properties right away, so you can set them before the first Transform.
The column to the right of the graph shows the state:
| State | Meaning |
|---|---|
| Live | The preview shows the graph as it is. The line also says how long the last compile took and how many values change without compiling. |
| Compiling... | A new preview shader compiles. The preview shows the last graph that compiled. |
| Error | The graph does not compile. The preview keeps the last graph that compiled, and the nodes the errors are about are outlined in red. |
| The preview shows the last Transform. | Live Preview is off. |
Live Preview: On / Off in that column switches it. The setting is stored per material and per user, like the other preview settings; it is not part of the asset.
Constants and typed-in values change in the preview without compiling, but Transform still writes them into the shader as fixed values. A shipped material costs the same as it would without the live preview.
Previewing a node
Every node with outputs has an eye button at the right of its header. Click it to show the node's first output on the preview model, unlit. Click it again, or click Stop Previewing Node in the status column, to show the material again. The node's context menu has Preview Output '...' for each of its outputs, and Stop Previewing.
While a node is previewed, its outline is green, its header says which output is shown, and the output pin has a ring. Scalars show as grey, two components as red and green, colours and vectors as they are. A previewed node does not have to be connected to the output node.
Node thumbnails
Node Thumbnails: On (in the status column) shows a small preview of each node's first output inside the node, so you can follow how a value changes along the graph. Up to 24 nodes get a thumbnail. Thumbnails work only while the live preview is on, and the setting is off by default.

Errors on nodes
When the graph does not compile, the status column lists the nodes the errors are about. Show '...' selects a node and frames it in the graph. Hover a red node to see the whole error.
Some errors are found before compiling, such as a required input that is not connected; those always name their node. Compiler errors name the node whose code they quote. An error that quotes no node's code is listed without a node.
Transform
Transform writes the shader the game uses and returns at once. The shader compiler then checks in the background that the shader compiles in each pass a material draws in (color, depth and shadows, the editor's debug views, picking). The status column shows Transform: checking that the shader compiles... and then the result. Exporting or packaging the project still compiles every permutation.
Open Shader File opens the shader that the last Transform generated.
Preview scene
The material window's toolbar has these preview controls. They apply to every material, not only to visual shaders.
| Button | What it does |
|---|---|
| Preview Model | Ball, Sphere, Box, Plane, or Custom Mesh: the mesh asset set in the Preview Mesh preference. |
| Preview Lighting | Studio (the preview's own lighting), Outdoor (a warm sun and a bright sky fill) or Night (a dim blue moon). |
| Rotate Light | Turns the Outdoor or Night light around the model. |
Asset thumbnails always use the Studio lighting.
Preferences
The material's document preferences:
| Preference | Default | Description |
|---|---|---|
| Parameter Detail | Advanced | Which shader parameters the properties list: Base, Advanced or All. |
| Live Preview | On | The preview follows every edit of the graph. |
| Preview Lighting | Studio | The lights of the preview scene. |
| Preview Mesh | none | The mesh of the Custom Mesh preview model. |
| Rotate Light | Off | Turns the preview's light around the model. |
| Node Thumbnails | Off | Shows each node's first output inside the node. |
Troubleshooting
- The preview does not change when I connect a node. Check that the status column says Live. Error names the problem. The preview shows the last Transform. means Live Preview is off.
- The column says the visual shader is not used by the material. Set Shader Mode to Visual Shader in the material's properties.
- New nodes from an edited node library (
.ddl) do not show. The editor reloads the node library when the file changes, and the preview compiles it without changing the transformed shader. Transform to ship it. - The game shows an older material than the preview. The preview never changes the asset. Transform the material.
- A post effect or sky material does nothing in the scene. Check that its output node is PostEffectOutput or SkyOutput and that it was transformed. A Sky Box ignores a material that is not a sky material and keeps its cube map.
- Where are the preview shaders? They are written next to the transformed shader, as
<Material>.preview<N>.plShaderin the AssetCache, and deleted when the material window closes.