Getting started with Unity's ShaderGraph

foreword

With the continuous upgrading of the Unity version, URP (Programmable Rendering Pipeline) is becoming more and more popular. No matter in terms of effect or performance, it is the old version of build-in-shader. So we have to start embracing URP anyway, and it's time to upgrade Unity.

engine version

I chose the Unity 2021.3.23f1 version here, as long as you choose the version between Unity2019-2021, you can.

create project

We can use the URP template to create a project. Our article is mainly about how to configure URP, so we create an empty 3D project and wait for a step-by-step configuration of the URP environment.
insert image description here

Configure the URP environment

We install the URP package through PackageManager, and it will automatically install the ShaderGraph package. If it is not installed automatically, please install ShaderGraph manually. Finally, please install URP Package Samples, which contains some shader examples and scenes for us to learn and use.
insert image description here
To configure the URP Global Setting, you can create a new one or select the URP Glable Settings of Samples
insert image description here
. Well, at this point, the URP configuration is complete.

Upgrade Build-In to URP

If we already have a lot of Build-In shaders or Material materials in our project. We will send them programming Magenta first, URP provides us with tools to upgrade to URP in batches
insert image description here

Create URPs

We use ShaderGraph to create our first URP
insert image description here
After the creation is successful, double-click the .shadergraph file to open the ShaderGraph panel, as shown below:
insert image description here

Getting to know ShaderGraph for the first time

Let's not talk about too much detail in this article, let's simply look at the layout of ShaderGraph
insert image description here

add node

We right-click CreateNode on the ShaderGraph panel to create a node.
insert image description here
We can drag and drop casually. For example, I added a Texture and Color to multiply and assign to the final fragment color.
insert image description here

at last

Well, this article is here,

Guess you like

Origin blog.csdn.net/qq563129582/article/details/130233853