What Are Shaders?

Shaders define the look of a game. Essentially, a shader uses information from a material to draw pixels to your screen. Some examples include snow accumulating on top of an object, a wavy effect on a surface that simulates water, or making a scene black and white.

Authoring shaders is complex and requires skill in both art and science. Node-based, shader-creation tools such as Shader Forge and Amplify have thus gained popularity. Unity has announced its own node-editor, Shader Graph, which is currently in beta. A node-editor does not completely replace shader coding, and so a versatile developer should be able to work with both.

Who Is This Book For?

This book is targeted at people new to shaders. The book starts right off with building a simple shader and slowly builds up the reader’s skill with more advanced concepts like post-processing, volumetric explosions, and more. This is a very hands-on approach that will have you working as you learn. Note that there is a fair bit of math involved in writing shaders.

Learning and Application Done Right

One of the biggest problems with your typical Unity book is that it doesn’t balance theory with application. The book does a great job here. It breaks down concepts, provides external resources for further learning, examines code step-by-step, explains everything in great detail in the “How It Works” section, and often provides extra insight in the “There’s More” section.

Downfall of the Book: Inconsistencies

Although most recipes are near perfect, some occasionally lack proper editing. This can lead to a recipe that if followed verbatim won’t work. These oversights ruin an otherwise stellar book, and the oscillating quality is frustrating to say the least. The source project also is occasionally missing a texture or scene.

A Stepping Stone

Despite the book’s shortcomings, I do have a much better understanding of shaders thanks to it. It takes a lot of patience to sift through the incomplete content, but there is so much good here that I felt it was worth it in the end.

Summary

Creating shaders is a complex subject that requires a lot of time and patience. Unity 5.x Shaders and Effects Cookbook does so much right, and despite its flaws (i.e., occasional poor editing and missing info), I still felt like it was a worthy read in the end.

My advice

Something I discovered after finishing the book is that Unity’s official shader tutorial is written by a co-author of this Cookbook. This is perplexing, as the quality of his tutorials is significantly better than the book. If you want to take learning shaders seriously, you might consider supporting him on Patreon. This will give you access to all of his tutorials. I highly recommend reading through his intro tutorial as it does a great job on the theory side. Coupled with the book, that would be a strong combination for beginners.

Pros

strong introduction to shaders

hands-on approach works well

builds a good foundation

concepts covered very well in most cases

source project comes with a lot of functional examples

clear, easy-to-follow instructions

good example pictures

coverage of legacy shaders will help veterans of Unity 4 update their skills

tons of external resources help direct learning of prerequisite knowledge (Cg/HLSL)

great coverage on performance / efficiency

Cons

occasional recipe suffers from lack of proper editing

source project missing a few files

outdated (seems to be using 5.4?)

could have had more external resources (e.g., image editing tutorials, math tutorials, etc.) to help advance skills

lack of common “gotchas” (areas a novice might struggle on or do incorrectly)

recipes occasionally rely on a separate poorly-explained recipe

Skill Level – Intermediate

Final Rating – 7/10 Recommended

Links

eBook

Node editors:

Programming resources: