34 lines
1.3 KiB
Markdown
34 lines
1.3 KiB
Markdown
# 2D Renderer and Shader Graph
|
|
|
|
## Creating a Lit Shader
|
|
|
|
1. Create a new Asset by selecting __Create > Shader > 2D Renderer > Lit Sprite Graph__.
|
|
|
|

|
|
|
|
|
|
|
|
2. Double-click the new Asset to open the __Shader Graph__.
|
|
|
|

|
|
|
|
3. Attach the Sample Texture 2D Nodes to Color, Mask, and Normal. Change the type on the sampler connected to normal from Default to Normal.
|
|
|
|

|
|
|
|
4. 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.
|
|
|
|
5. Drag MainTex, Mask, and Normal from the Blackboard to the Shader Graph work area.
|
|
|
|
6. Connect the MainTex, Mask, and Normal nodes to their respective Sample Texture2D nodes.
|
|
|
|
7. Select 'Save Asset' to save the Shader.
|
|
|
|

|
|
|
|
You can now assign new materials to the newly built Shader.
|