Search Unity

New Shader Graph feature examples in 2022 LTS

March 19, 2024 in Engine & platform | 5 min. read
Shader Graph feature examples
Shader Graph feature examples
Share

Is this article helpful for you?

Thank you for your feedback!

The Shader Graph team is excited to announce the release of our newest set of samples, available to import now in 2022 LTS and with the upcoming Unity 6 Preview (2023.3). 

With this sample set, our goal is to provide examples of how to achieve a wide range of effects and techniques using Shader Graph. If there’s an effect you want to add to a shader, it’s often available online in the form of a math equation or code – both of which may be out of reach for some. We want to make it easier for you to achieve the effects you’re looking for.

Shader features such as parallax mapping, interior cube mapping, angle blending, flow mapping, and custom lighting are just five of the over 30 different feature examples available in this set. While these examples don’t provide complete shader solutions, they do show you how to create specific effects, and most are neatly encapsulated in subgraphs, so they’re easy to drag and drop into your own shaders.

This content is hosted by a third party provider that does not allow video views without acceptance of Targeting Cookies. Please set your cookie preferences for Targeting Cookies to yes if you wish to view videos from these providers.

Check out our Shader Graph: Learn with Feature Examples tutorial for a deeper dive into how to use the features below.

Here’s a full list of the sample categories.

Blending Masks: This set of blending mask subgraphs includes altitude blending, angle blending, camera distance blending, and height blending.

Blend Masks category of samples
Blend Masks category of samples

Conditional Branching: Find two examples of how to branch your shader, depending on which render pipeline you’re using and the quality level you select.

Conditional Branching category of samples
Conditional Branching category of samples

Custom Interpolator: This offers an illustration of how to improve performance by moving operations to the vertex stage, including an illustration of some effects that don’t work very well when computed per-vertex.

Custom Interpolator category of samples
Custom Interpolator category of samples

Custom Lighting: Many of you have asked for a way to customize how lighting works in Shader Graph, either to make lighting cheaper to render or to achieve a unique artistic style for a project. These samples show how that can be done and include an example of PBR lighting, simple lighting, and a cel shader.

Custom Lighting category of samples
Custom Lighting category of samples

Detail Mapping: This set includes three different techniques for applying more detail to a material using detail mapping: color detail, normal detail, and full material detail.

Detail Mapping category of samples
Detail Mapping category of samples

Procedural Noise and Shapes: It’s often more cost effective to generate patterns procedurally rather than using texture maps. This category contains an example of how to generate a brick pattern procedurally, a subgraph for generating a hexagon grid, and a set of signed distance field shapes.

Procedural Noise and Shapes category of samples
Procedural Noise and Shapes category of samples

Shader Graph Feature Examples: Shader Graph has several features that can be tricky to master, such as subgraph dropdowns and branching based on input connection. This section contains examples of how you can use these features to improve subgraphs’ usefulness.

Shader Graph Feature Examples category of samples
Shader Graph Feature Examples category of samples

UV Projection: A large set of features are based on the manipulation of UV coordinates, including flipbook blending, flow mapping, interior cube mapping, latitude longitude projection, matcap or sphere projection, parallax mapping, and triplanar projection. This section includes all of these effects.

UV Projection category of samples
UV Projection category of samples

Vertex Animation: When most people think of Shader Graph, they think of pixel shaders, but Shader Graph can also animate vertices using the vertex stage.  These examples include a waving flag, a bend deformer, a camera-facing billboard effect, Gerstner waves, and a full-featured particle system built entirely in Shader Graph.

Vertex Animation category of samples
Vertex Animation category of samples

How to install the sample assets

Install the new sample assets using the Package Manager.

  1. In the Editor, open Package Manager.
The Window menu showing the Package Manager option
The Window menu showing the Package Manager option

2. In the Package Manager window, select the Shader Graph package.

The Package Manager window with the Shader Graph package selected
The Package Manager window with the Shader Graph package selected

3. Select the Samples tab.

Import button
The details of the Shader Graph package in the Package Manager showing the button to import the Feature Examples sample

4. Finally, click the Import button in the Feature Examples section to bring the new sample set into your project.

With these steps completed, the Feature Examples assets will show up in your project under Assets/Samples/Shader Graph/<your version>/Feature Examples.

The location of the Node Reference Samples in the Project window
The location of the Node Reference Samples in the Project window

After importing the samples, get started by opening the scene that corresponds to the render pipeline you’re using (High Definition Render Pipeline, or HDRP, Universal Render Pipeline, or URP, or the Built-in Render Pipeline) in the Scenes folder.

Selecting the correct scene to open in the Project window
Selecting the correct scene to open in the Project window

Once the scene is open, select the Shader Graph Feature Samples Showcase asset in the Hierarchy panel, then follow the guided tour in the Inspector.

Selecting the Showcase asset at the top of the Hierarchy panel
Selecting the Showcase asset at the top of the Hierarchy panel
The tour guide panel that appears when you select the Showcase asset
The tour guide panel that appears when you select the Showcase asset

You can use the Samples dropdown box to select a sample and jump to that location in the scene.

What’s new for Shader Graph

We’re continuing to add more samples to Shader Graph, and we have several more sample packs in the coming months. These will help you learn Shader Graph more quickly, understand how to set up specific functionality, and create new shaders faster with premade subgraphs and templates. We hope you’ll enjoy using them.

Additional resources

This is a very deep and rich sample set. We hope you have fun exploring it and use it to speed up your own shader creation process. 

We’d love to hear your thoughts and impressions on these samples – tell us what you think in the Shader Graph forum.

March 19, 2024 in Engine & platform | 5 min. read

Is this article helpful for you?

Thank you for your feedback!

Related Posts