Create Your FIRST SHADER in Shader Graph
ACCESS the FULL COURSE here: https://academy.zenva.com/product/unity-game-development-mini-degree/?zva_src=youtube-gamedevmd TRANSCRIPT Hey, everyone, and welcome back to the course. In this lesson, we are going to go over how to create a new shader for Shader Graph, and then we're gonna go over what is Shader Graph, how does it work and what all the various different components in that do, how to connect nodes, how to then create that into a material that we can apply to our model. So, first of all, I'm going to create a new folder here called Shaders. And this is where we are going to store all of our various shaders we create with shader graph. So in here, I'm gonna right-click. To create a brand new shader, we can right-click here in the folder, go to create. Then we wanna hover over the Shader selection and choose PBR Graph. This creates us a shader graph. And I'm just gonna call this one our ExampleShader. And as you can see, it creates the shader folder, which is this S here. And to open the Shader Graph editor, we can either double-click on this file or go up to this Open Shader Editor button in the Inspector. Click on that. Then we should open is a window something like this. It is a graph here that we can then edit and create our shaders in. So how does it work? Well, Shader Graph is set up using nodes. You connect various nodes together, which can do various different things, like add two effects together, create new ones, allow for inputs. And the final result all plugs into the PBR Master node right here, which is something similar to how you would look at the standard asset, how you look at the standard shader. You have your Albedo, Normal, Metallic, Smoothness, Alpha, all that sorta stuff that, you would want to change the overall appearance of your model. So, how do we actually navigate first of all, well what we can do is to move around, we can hold down middle mouse button and start dragging around to just navigate around. You can also zoom in and out with the scroll wheel to have a much better view of your shader. And also, then, to create new nodes, we can right-click and go Create node. And here you'll see that there are a bunch of various different categories, Artistic. It's just a various number of selections. We won't, of course, be using all of these. We'll probably be using only around maybe 20 or so different nodes throughout this course. We'll go over in detail what they do and how they work with the other nodes, as well. But for now, let's just have a look at some of the other aspects inside of the Shader Graph here. First of all, you might see up here where it says example shader. This over here is the Blackboard. What the Blackboard is is basically like a variable list. If you've ever looked at a material, such as the standard shader or any other sort of materials you'll see, you'll notice that in the Inspector there are a bunch of different properties that you can edit, like the color, the smoothness, the metallic level, the mission, all these various different properties that you'll also if you were to create a variable in a script. So that is basically what the Blackboard is. To create a new variable or property, we can go and click on this plus icon here. And then we can choose between a bunch of different data types here. Now you might notice that you don't have your traditional ints or flaots here like you do in C sharp. Instead, if you wanna create just a number, you would select Vector1. And here we could name it something like MyNumber. And then we can enter in a default value for that we can choose if it is Exposed or not. This is pretty much similar to is it public or private does it appear in the inspector for us. This Reference here is if we want to access this property inside of a script, we will be accessing it by this reference, you can change that if you wish. Some other variable types, you can have your colors, so you can see a default color here in the Color wheel. You can also choose that to be a HDR color, which stands for high dynamic range and allows you to add intensity. So if you do have things such as bloom, or post processing effects like we currently do in our project, you'll be able to see these codes more intensely, and they'll appear to be very broad.
Download
0 formatsNo download links available.