1.3 KiB
2D Renderer and Shader Graph
Creating a Lit Shader
-
Create a new Asset by selecting Create > Shader > 2D Renderer > Lit Sprite Graph.
-
Double-click the new Asset to open the Shader Graph.
-
Attach the Sample Texture 2D Nodes to Color, Mask, and Normal. Change the type on the sampler connected to normal from Default to Normal.
-
In the Blackboard on the left side, add three new Texture2D items which can be named anything. However, it is required to name the reference for MainTex as _MainTex to render Sprites. It is also recommended to name the references for Mask as _MaskTex and Normal as _NormalMap to match the Shader inputs used in this package.
Lastly the mode on Normal should be set to Bump so that if a normal map is not supplied, an appropriate default Texture is still available.
-
Drag MainTex, Mask, and Normal from the Blackboard to the Shader Graph work area.
-
Connect the MainTex, Mask, and Normal nodes to their respective Sample Texture2D nodes.
-
Select 'Save Asset' to save the Shader.
You can now assign new materials to the newly built Shader.