- EvelynFull-time IndieDev.I'm Japanese, so please forgive me if my English is strange.
There's also a Youtube video that explains it all, so if you're having trouble understanding just the text info, watch the video!
Work with a rendering pipeline that allows shader graphs.
I use the Universal Render Pipeline (URP) to capture my screens.
Creating Grid Shader
First, make sure that the Shader Graph has been imported in the Package Manager.
Next, right-click in the project window and select Lit Shader Graph in the shader graph.
Double-click on the generated file to start editing.
The whole thing looks like this.
We will add variables so that the parameters can be adjusted from the material.
First, add a Float type Tile Amount and put your favorite value in the Default Value.
We can use this variable to adjust the level of detail in the grid.
Next, add a Line Thickness of Float type and set the Default Value to 0.9.
If the value is set to more than 1, the line will disappear, so change the Mode to Slider so that the value can only be changed between 0 and 1.
In addition, we will add Color.
The color specified by this variable will be used in the guri
By creating a Rectangle node and connecting One Minus as shown in the image, and connecting the output results of Color and Multiply to Base Color and Emission, a rectangle will be displayed.
The Tiling And Offset node and the Fraction node can be gridded by attaching them to the Rectangle node.
Using the shaders created here, you can easily display the grid like this.
What did you think?
Please try to use the shaders created in this blog post in your own game development.