Glossary term

Shader Graph

What is Shader Graph?

Shader Graph is a visual, node-based tool in the Unity Editor for creating shaders, the programs that determine how surfaces look, by connecting nodes in a graph instead of writing shader code. It provides a live preview so you can see changes as you build.

Shader Graph is one of Unity's graphics tools, alongside VFX Graph, and provides nodes for math, textures, lighting, and procedural effects.

How does Shader Graph work?

A Shader Graph is built from several core parts:

  • Nodes: Each node performs an operation, such as sampling a texture, multiplying two colors, or calculating a Fresnel effect.
  • Connections: Lines between node ports pass values from one operation to the next, forming the shader's logic.
  • Master Stack: The final stage of the graph, with Vertex and Fragment contexts that define properties such as base color, normal, emission, and alpha.
  • Blackboard: Exposed properties, such as colors or textures, that artists can adjust on each material without editing the graph.
  • Previews: Node previews and the main preview window show how changes affect the shader as the graph is edited.

Unity then compiles the graph into shader code that runs on the GPU.

What types of Shader Graph can you create?

Shader Graph offers different graph types for different rendering needs:

Graph type

Lit

Used for

Surfaces that respond to scene lighting, such as metal, wood, or skin

Unlit

Used for

Surfaces that do not respond to scene lighting, such as stylized effects, holograms, or glowing UI

Sprite

Used for

2D sprites, including sprites affected by URP's 2D lights

Decal

Used for

Details projected onto other surfaces, such as dirt, graffiti, or bullet holes

Fullscreen

Used for

Full-screen effects, such as post-processing effects

Canvas

Used for

Custom effects and materials for UI elements

What is Shader Graph used for?

Shader Graph can be used to create a wide range of custom materials and visual effects, including:

  • Stylized and toon shading: Create cel-shaded, painterly, or other stylized looks.
  • Dissolve and hologram effects: Fade, dissolve, flicker, or otherwise transform objects for gameplay feedback and sci-fi visuals.
  • Water and foliage: Create animated water, refraction effects, and wind-blown grass or leaves.
  • Procedural textures: Generate patterns such as noise, stripes, and scrolling effects without relying on pre-made texture files.
  • Full-screen effects: Build custom effects such as outlines, color adjustments, and other screen-space effects with Fullscreen graphs.

What is the difference between Shader Graph and writing shaders in code?

Shader Graph and hand-written shaders can produce similar results through different workflows:

How you build

Shader Graph

Connect nodes visually

Hand-written shaders

Write HLSL and ShaderLab code

Feedback

Shader Graph

Live previews while editing

Hand-written shaders

Recompile and check the result in the scene

Typical users

Shader Graph

Artists, technical artists, and programmers

Hand-written shaders

Graphics programmers

Flexibility

Shader Graph

Supports a wide range of effects; Custom Function nodes can add HLSL when needed

Hand-written shaders

Provides direct control over shader code and rendering behavior

Many teams use both, with Shader Graph handling many materials and hand-written shaders used when more specialized control is needed.

What are the benefits of Shader Graph?

  • Visual authoring: Artists can build shaders without writing HLSL for many common materials and effects.
  • Faster iteration: Live previews make it easier to see the results of changes as you edit the graph.
  • Reusable building blocks: Sub Graphs package common groups of nodes for reuse across multiple shaders.
  • Shared workflow: Artists, technical artists, and programmers can read and edit the same graph.

What are the challenges of Shader Graph?

  • Performance considerations: Complex graphs can compile into shaders with significant performance costs, so effects should be profiled on target hardware.
  • Some effects still need code: Highly specialized techniques may require Custom Function nodes with HLSL or hand-written shaders.
  • Large graphs can become difficult to maintain: Teams can use groups, sticky notes, and Sub Graphs to organize complex graphs and improve readability.

Shader Graph examples and resources

Shader Graph is available for projects using URP and HDRP, and you can create a Shader Graph asset from the Project window's Create menu and assign it to a material. Unity's e-book Create popular shaders and visual effects with URP walks through effects such as toon shading, water, and procedural noise. The Shader Graph documentation provides reference information for Shader Graph features and nodes.

Frequently asked questions (FAQ)