Welcome to the Unity Shader Learning Repository! This project serves as an instructional guide for those looking to better understand shader programming in Unity. Whether you're new to shaders or aiming to deepen your knowledge, this repository provides hands-on examples and theoretical insights.
This repository contains:
- A Unity project featuring simple shader implementations.
- Three Markdown documents explaining shader concepts, techniques, and best practices in Unity.
Note
Do not take this repository as the best possible approach to shaders, either from a practical or optimization perspective.
The goal of this repository is to present shader concepts in the most comprehensible way to help learners understand the core logic behind shader programming.
For a deeper dive into shader programming, check out the following theory guides:
-
Shader Anatomy
Here we explore how a shader is structured, its high-level organization, and the purpose of each block. -
Shader Programs
Covers the basics of shader languages in Unity, focusing onHLSL
but also mentioningCG
as a legacy language, and explains how they apply to different rendering pipelines. -
Shader Programming in Scriptable Render Pipelines
Explores how shader programming evolved along with Unity's Scriptable Render Pipelines (SRP
), including URP and HDRP.
Within the Unity project, you'll find:
- Basic shader implementations demonstrating fundamental techniques.
- Examples using ShaderGraph to illustrate visual shader creation.
- Handwritten HLSL shaders showcasing custom solutions for different rendering pipelines.
To explore the project:
- Clone the repository:
- Open the Unity project in Unity (tested on version 6000.0.50f1).
- Open the
Sample Scene
and play it in maximized mode for a quick overview. - Explore the
Shaders
folder for step-by-step shaders with highly commented code. - Read the Markdown documentation for a deeper understanding.